Skip to content

Commit

Permalink
Add basic test for switching autoscale status.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Nov 23, 2015
1 parent 5586d43 commit 4f30cce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4118,6 +4118,23 @@ def test_axisbg_warning():
("The axisbg attribute was deprecated in version 2.0.")))


@cleanup
def test_autoscale():
plt.plot([0, 1], [0, 1])
assert_equal(plt.xlim(), (0, 1))
plt.autoscale(False)
plt.plot([2, 3], [2, 3])
assert_equal(plt.xlim(), (0, 1))
plt.autoscale(True)
plt.plot([1, 2], [1, 2])
assert_equal(plt.xlim(), (0, 3))
with plt.autoscale(False):
plt.plot([3, 4], [3, 4])
assert_equal(plt.xlim(), (0, 3))
plt.plot([4, 5], [4, 5])
assert_equal(plt.xlim(), (0, 5))


if __name__ == '__main__':
import nose
import sys
Expand Down

0 comments on commit 4f30cce

Please sign in to comment.