Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 339dcb1

Browse files
committed
TST: add coverage for case when the figure is not visible
1 parent bcec42b commit 339dcb1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,3 +1636,18 @@ def test_get_constrained_layout_pads():
16361636
fig = plt.figure(layout=mpl.layout_engine.ConstrainedLayoutEngine(**params))
16371637
with pytest.warns(PendingDeprecationWarning, match="will be deprecated"):
16381638
assert fig.get_constrained_layout_pads() == expected
1639+
1640+
1641+
def test_not_visible_figure():
1642+
fig = Figure()
1643+
1644+
buf = io.StringIO()
1645+
fig.savefig(buf, format='svg')
1646+
buf.seek(0)
1647+
assert '<g ' in buf.read()
1648+
1649+
fig.set_visible(False)
1650+
buf = io.StringIO()
1651+
fig.savefig(buf, format='svg')
1652+
buf.seek(0)
1653+
assert '<g ' not in buf.read()

0 commit comments

Comments
 (0)