8000 Add basic test for switching autoscale status. · matplotlib/matplotlib@4f30cce · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f30cce

Browse files
committed
Add basic test for switching autoscale status.
1 parent 5586d43 commit 4f30cce

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4118,6 +4118,23 @@ def test_axisbg_warning():
41184118
("The axisbg attribute was deprecated in version 2.0.")))
4 B5B5 1194119

41204120

4121+
@cleanup
4122+
def test_autoscale():
4123+
plt.plot([0, 1], [0, 1])
4124+
assert_equal(plt.xlim(), (0, 1))
4125+
plt.autoscale(False)
4126+
plt.plot([2, 3], [2, 3])
4127+
assert_equal(plt.xlim(), (0, 1))
4128+
plt.autoscale(True)
4129+
plt.plot([1, 2], [1, 2])
4130+
assert_equal(plt.xlim(), (0, 3))
4131+
with plt.autoscale(False):
4132+
plt.plot([3, 4], [3, 4])
4133+
assert_equal(plt.xlim(), (0, 3))
4134+
plt.plot([4, 5], [4, 5])
4135+
assert_equal(plt.xlim(), (0, 5))
4136+
4137+
41214138
if __name__ == '__main__':
41224139
import nose
41234140
import sys

0 commit comments

Comments
 (0)
0