Skip to content

Commit c25e710

Browse files
committed
Fix deepcopy/pickle tests
1 parent 46a87bd commit c25e710

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/python/plotly/plotly/tests/test_io/test_deepcopy_pickle.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_deepcopy_figure(fig1):
3838
fig_copied = copy.deepcopy(fig1)
3939

4040
# Contents should be equal
41-
assert pio.to_json(fig_copied) == pio.to_json(fig1)
41+
assert fig_copied.to_dict() == fig1.to_dict()
4242

4343
# Identities should be distinct
4444
assert fig_copied is not fig1
@@ -50,7 +50,7 @@ def test_deepcopy_figure_subplots(fig_subplots):
5050
fig_copied = copy.deepcopy(fig_subplots)
5151

5252
# Contents should be equal
53-
assert pio.to_json(fig_copied) == pio.to_json(fig_subplots)
53+
assert fig_copied.to_dict() == fig_subplots.to_dict()
5454

5555
# Subplot metadata should be equal
5656
assert fig_subplots._grid_ref == fig_copied._grid_ref
@@ -66,7 +66,7 @@ def test_deepcopy_figure_subplots(fig_subplots):
6666
fig_copied.add_bar(y=[0, 0, 1], row=1, col=2)
6767

6868
# And contents should be still equal
69-
assert pio.to_json(fig_copied) == pio.to_json(fig_subplots)
69+
assert fig_copied.to_dict() == fig_subplots.to_dict()
7070

7171

7272
def test_deepcopy_layout(fig1):
@@ -91,21 +91,21 @@ def test_pickle_figure_round_trip(fig1):
9191
fig_copied = pickle.loads(pickle.dumps(fig1))
9292

9393
# Contents should be equal
94-
assert pio.to_json(fig_copied) == pio.to_json(fig1)
94+
assert fig_copied.to_dict() == fig1.to_dict()
9595

9696

9797
def test_pickle_figure_subplots_round_trip(fig_subplots):
9898
fig_copied = pickle.loads(pickle.dumps(fig_subplots))
9999

100100
# Contents should be equal
101-
assert pio.to_json(fig_copied) == pio.to_json(fig_subplots)
101+
assert fig_copied.to_dict() == fig_subplots.to_dict()
102102

103103
# Should be possible to add new trace to subplot location
104104
fig_subplots.add_bar(y=[0, 0, 1], row=1, col=2)
105105
fig_copied.add_bar(y=[0, 0, 1], row=1, col=2)
106106

107107
# And contents should be still equal
108-
assert pio.to_json(fig_copied) == pio.to_json(fig_subplots)
108+
assert fig_copied.to_dict() == fig_subplots.to_dict()
109109

110110

111111
def test_pickle_layout(fig1):

0 commit comments

Comments
 (0)