Skip to content

Commit 0f68aff

Browse files
committed
Add validator test to basetraces validator
1 parent 644992f commit 0f68aff

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
from _plotly_utils.basevalidators import BaseDataValidator
33
from plotly.graph_objs import Scatter, Bar, Box
4-
4+
import numpy as np
55

66
# Fixtures
77
# --------
@@ -118,6 +118,19 @@ def test_rejection_element_tracetype(validator):
118118
assert "Invalid element(s)" in str(validation_failure.value)
119119

120120

121+
def test_b64(validator):
122+
val = [dict(type="scatter", x=np.array([1, 2, 3]))]
123+
res = validator.validate_coerce(val)
124+
res_present = validator.present(res)
125+
126+
assert isinstance(res, list)
127+
assert isinstance(res_present, tuple)
128+
129+
assert isinstance(res_present[0], Scatter)
130+
assert res_present[0].type == "scatter"
131+
assert res_present[0].x == {"bdata": "AQID", "dtype": "i1"}
132+
133+
121134
def test_skip_invalid(validator_nouid):
122135
val = (
123136
dict(

0 commit comments

Comments
 (0)