Skip to content

Commit 2a81d2a

Browse files
committed
Add more validator tests
1 parent 0f68aff commit 2a81d2a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

packages/python/plotly/_plotly_utils/tests/validators/test_angle_validator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# from ..basevalidators import AngleValidator
44
from _plotly_utils.basevalidators import AngleValidator
55
import numpy as np
6+
from plotly.tests.b64 import b64
67

78

89
# Fixtures
@@ -51,6 +52,13 @@ def test_aok_acceptance(val, validator_aok):
5152
assert np.array_equal(validator_aok.validate_coerce(np.array(val)), np.array(val))
5253

5354

55+
# Test base64 array
56+
def test_aok_base64_array(validator_aok):
57+
val = b64(np.array([1, 2, 3], dtype="int64"))
58+
coerce_val = validator_aok.validate_coerce(val)
59+
assert coerce_val["bdata"] == "AQID"
60+
assert coerce_val["dtype"] == "i1"
61+
5462
# ### Test coercion above 180 ###
5563
@pytest.mark.parametrize(
5664
"val,expected",

packages/python/plotly/_plotly_utils/tests/validators/test_any_validator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
from _plotly_utils.basevalidators import AnyValidator
33
import numpy as np
4+
from plotly.tests.b64 import b64
45

56

67
# Fixtures
@@ -49,3 +50,9 @@ def test_acceptance_array(val, validator_aok):
4950
else:
5051
assert coerce_val == val
5152
assert validator_aok.present(coerce_val) == val
53+
54+
def test_base64_array(validator_aok):
55+
val = b64(np.array([1, 2, 3], dtype="int64"))
56+
coerce_val = validator_aok.validate_coerce(val)
57+
assert coerce_val['bdata'] == "AQID"
58+
assert coerce_val['dtype'] == "i1"

packages/python/plotly/plotly/tests/test_optional/test_graph_objs/test_performance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_performance_b64_scatter3d():
5656
np_time_elapsed = time.time() - np_start
5757

5858
# np should be faster than lists
59-
assert (np_time_elapsed / list_time_elapsed) < 0.75
59+
assert (np_time_elapsed / list_time_elapsed) < 0.78
6060

6161

6262
FLOAT_TEST_CASES = [

0 commit comments

Comments
 (0)