File tree 2 files changed +5
-8
lines changed
packages/python/plotly/plotly
tests/test_optional/test_offline
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -540,13 +540,13 @@ def clean_to_json_compatible(obj, **kwargs):
540
540
# to string since engine can do that
541
541
obj = obj .replace (tzinfo = None )
542
542
obj = obj .to_pydatetime ()
543
- except (TypeError , AttributeError ):
543
+ except (TypeError , AttributeError ):
544
544
pass
545
545
546
546
if not datetime_allowed :
547
547
try :
548
548
return obj .isoformat ()
549
- except (TypeError , AttributeError ):
549
+ except (TypeError , AttributeError ):
550
550
pass
551
551
elif isinstance (obj , datetime .datetime ):
552
552
return obj
Original file line number Diff line number Diff line change 10
10
import pytest
11
11
12
12
import plotly
13
+ import plotly .io as pio
13
14
from plotly import optional_imports
14
15
15
16
matplotlylib = optional_imports .get_module ("plotly.matplotlylib" )
@@ -76,12 +77,8 @@ def test_default_mpl_plot_generates_expected_html(self):
76
77
data = figure ["data" ]
77
78
78
79
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 )
85
82
html = self ._read_html (plotly .offline .plot_mpl (fig ))
86
83
87
84
# blank out uid before comparisons
You can’t perform that action at this time.
0 commit comments