MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_deepcopy_figure_subplots

Function test_deepcopy_figure_subplots

tests/test_io/test_deepcopy_pickle.py:48–68  ·  view source on GitHub ↗
(fig_subplots)

Source from the content-addressed store, hash-verified

46
47
48def test_deepcopy_figure_subplots(fig_subplots):
49 fig_copied = copy.deepcopy(fig_subplots)
50
51 # Contents should be equal
52 assert fig_copied.to_dict() == fig_subplots.to_dict()
53
54 # Subplot metadata should be equal
55 assert fig_subplots._grid_ref == fig_copied._grid_ref
56 assert fig_subplots._grid_str == fig_copied._grid_str
57
58 # Identities should be distinct
59 assert fig_copied is not fig_subplots
60 assert fig_copied.layout is not fig_subplots.layout
61 assert fig_copied.data is not fig_subplots.data
62
63 # Should be possible to add new trace to subplot location
64 fig_subplots.add_bar(y=[0, 0, 1], row=1, col=2)
65 fig_copied.add_bar(y=[0, 0, 1], row=1, col=2)
66
67 # And contents should be still equal
68 assert fig_copied.to_dict() == fig_subplots.to_dict()
69
70
71def test_deepcopy_layout(fig1):

Callers

nothing calls this directly

Calls 2

to_dictMethod · 0.80
add_barMethod · 0.45

Tested by

no test coverage detected