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

Skip to content

Commit 7746cdf

Browse files
committed
test nested ion/ioff contexts
1 parent 0b11f80 commit 7746cdf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/matplotlib/tests/test_pyplot.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,23 @@ def test_ion():
109109
with plt.ion():
110110
assert mpl.is_interactive()
111111
assert mpl.is_interactive()
112+
113+
def test_nested_ion_ioff():
114+
plt.ion()
115+
with plt.ioff():
116+
assert not mpl.is_interactive()
117+
with plt.ion():
118+
assert mpl.is_interactive()
119+
assert not mpl.is_interactive()
120+
assert mpl.is_interactive()
121+
122+
with plt.ioff():
123+
with plt.ioff():
124+
assert not mpl.is_interactive()
125+
assert mpl.is_interactive()
126+
127+
plt.ioff()
128+
with plt.ion():
129+
with plt.ion():
130+
assert mpl.is_interactive()
131+
assert not mpl.is_interactive()

0 commit comments

Comments
 (0)