Skip to content

Commit 137fcb4

Browse files
committed
Merge branch 'orjson_encoding' into orjson_encoding_instrumentation
2 parents 7eeeac0 + 042c54c commit 137fcb4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Diff for: packages/python/plotly/plotly/io/_json.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,13 @@ def clean_to_json_compatible(obj, **kwargs):
540540
# to string since engine can do that
541541
obj = obj.replace(tzinfo=None)
542542
obj = obj.to_pydatetime()
543-
except(TypeError, AttributeError):
543+
except (TypeError, AttributeError):
544544
pass
545545

546546
if not datetime_allowed:
547547
try:
548548
return obj.isoformat()
549-
except(TypeError, AttributeError):
549+
except (TypeError, AttributeError):
550550
pass
551551
elif isinstance(obj, datetime.datetime):
552552
return obj

Diff for: packages/python/plotly/plotly/tests/test_optional/test_offline/test_offline.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import pytest
1111

1212
import plotly
13+
import plotly.io as pio
1314
from plotly import optional_imports
1415

1516
matplotlylib = optional_imports.get_module("plotly.matplotlylib")
@@ -76,12 +77,8 @@ def test_default_mpl_plot_generates_expected_html(self):
7677
data = figure["data"]
7778

7879
layout = figure["layout"]
79-
data_json = _json.dumps(
80-
data, cls=plotly.utils.PlotlyJSONEncoder, sort_keys=True
81-
)
82-
layout_json = _json.dumps(
83-
layout, cls=plotly.utils.PlotlyJSONEncoder, sort_keys=True
84-
)
80+
data_json = pio.json.to_json_plotly(data)
81+
layout_json = pio.json.to_json_plotly(layout)
8582
html = self._read_html(plotly.offline.plot_mpl(fig))
8683

8784
# blank out uid before comparisons

0 commit comments

Comments
 (0)