@@ -51,15 +51,15 @@ def build_test_dict_string(value_string, pretty=False):
51
51
52
52
53
53
def check_roundtrip (value , engine , pretty ):
54
- encoded = pio .to_plotly_json (value , engine = engine , pretty = pretty )
55
- decoded = pio .from_plotly_json (encoded , engine = engine )
56
- reencoded = pio .to_plotly_json (decoded , engine = engine , pretty = pretty )
54
+ encoded = pio .to_json_plotly (value , engine = engine , pretty = pretty )
55
+ decoded = pio .from_json_plotly (encoded , engine = engine )
56
+ reencoded = pio .to_json_plotly (decoded , engine = engine , pretty = pretty )
57
57
assert encoded == reencoded
58
58
59
59
# Check from_plotly_json with bytes on Python 3
60
60
if sys .version_info .major == 3 :
61
61
encoded_bytes = encoded .encode ("utf8" )
62
- decoded_from_bytes = pio .from_plotly_json (encoded_bytes , engine = engine )
62
+ decoded_from_bytes = pio .from_json_plotly (encoded_bytes , engine = engine )
63
63
assert decoded == decoded_from_bytes
64
64
65
65
@@ -124,15 +124,15 @@ def datetime_array(request, datetime_value):
124
124
# Encoding tests
125
125
def test_graph_object_input (engine , pretty ):
126
126
scatter = go .Scatter (x = [1 , 2 , 3 ], y = np .array ([4 , 5 , 6 ]))
127
- result = pio .to_plotly_json (scatter , engine = engine )
127
+ result = pio .to_json_plotly (scatter , engine = engine )
128
128
expected = """{"type":"scatter","x":[1,2,3],"y":[4,5,6]}"""
129
129
assert result == expected
130
130
check_roundtrip (result , engine = engine , pretty = pretty )
131
131
132
132
133
133
def test_numeric_numpy_encoding (numeric_numpy_array , engine , pretty ):
134
134
value = build_test_dict (numeric_numpy_array )
135
- result = pio .to_plotly_json (value , engine = engine , pretty = pretty )
135
+ result = pio .to_json_plotly (value , engine = engine , pretty = pretty )
136
136
137
137
array_str = to_json_test (numeric_numpy_array .tolist ())
138
138
expected = build_test_dict_string (array_str , pretty = pretty )
@@ -142,7 +142,7 @@ def test_numeric_numpy_encoding(numeric_numpy_array, engine, pretty):
142
142
143
143
def test_object_numpy_encoding (object_numpy_array , engine , pretty ):
144
144
value = build_test_dict (object_numpy_array )
145
- result = pio .to_plotly_json (value , engine = engine , pretty = pretty )
145
+ result = pio .to_json_plotly (value , engine = engine , pretty = pretty )
146
146
147
147
array_str = to_json_test (object_numpy_array .tolist ())
148
148
expected = build_test_dict_string (array_str )
@@ -155,15 +155,15 @@ def test_datetime(datetime_value, engine, pretty):
155
155
pytest .skip ("legacy encoder doesn't strip timezone from scalar datetimes" )
156
156
157
157
value = build_test_dict (datetime_value )
158
- result = pio .to_plotly_json (value , engine = engine , pretty = pretty )
158
+ result = pio .to_json_plotly (value , engine = engine , pretty = pretty )
159
159
expected = build_test_dict_string ('"{}"' .format (isoformat_test (datetime_value )))
160
160
assert result == expected
161
161
check_roundtrip (result , engine = engine , pretty = pretty )
162
162
163
163
164
164
def test_datetime_arrays (datetime_array , engine , pretty ):
165
165
value = build_test_dict (datetime_array )
166
- result = pio .to_plotly_json (value , engine = engine )
166
+ result = pio .to_json_plotly (value , engine = engine )
167
167
168
168
if isinstance (datetime_array , pd .Series ):
169
169
dt_values = [d .isoformat () for d in datetime_array .dt .to_pydatetime ().tolist ()]
0 commit comments