Skip to content

Commit dc16da6

Browse files
committed
Fix validator tests
1 parent 1718a73 commit dc16da6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: packages/python/plotly/_plotly_utils/tests/validators/test_basetraces_validator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_rejection_type(validator):
8484
with pytest.raises(ValueError) as validation_failure:
8585
validator.validate_coerce(val)
8686

87-
assert "Invalid value" in str(validation_failure.value)
87+
assert "Invalid element(s)" in str(validation_failure.value)
8888

8989

9090
def test_rejection_element_type(validator):

Diff for: packages/python/plotly/_plotly_utils/tests/validators/test_imageuri_validator.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import base64
2-
2+
import os
33
import pytest
44
from _plotly_utils.basevalidators import ImageUriValidator
5-
import numpy as np
5+
66
from PIL import Image
77

88

@@ -28,7 +28,9 @@ def test_validator_acceptance(val, validator):
2828
def test_validator_coercion_PIL(validator):
2929
# Single pixel black png (http://png-pixel.com/)
3030

31-
img_path = '_plotly_utils/tests/resources/1x1-black.png'
31+
tests_dir = os.path.dirname(os.path.dirname(__file__))
32+
img_path = os.path.join(tests_dir, 'resources', '1x1-black.png')
33+
3234
with open(img_path, 'rb') as f:
3335
hex_bytes = base64.b64encode(f.read()).decode('ascii')
3436
expected_uri = 'data:image/png;base64,' + hex_bytes

0 commit comments

Comments
 (0)