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

Skip to content

Commit f4e4c10

Browse files
committed
Add test of MaxNLocator integer option.
1 parent 688fbee commit f4e4c10

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ def test_MaxNLocator():
2727
assert_almost_equal(loc.tick_values(-1e15, 1e15), test_value)
2828

2929

30+
@cleanup
31+
def test_MaxNLocator_integer():
32+
loc = mticker.MaxNLocator(nbins=5, integer=True)
33+
test_value = np.array([-1, 0, 1, 2])
34+
assert_almost_equal(loc.tick_values(-0.1, 1.1), test_value)
35+
36+
test_value = np.array([-0.25, 0, 0.25, 0.5, 0.75, 1])
37+
assert_almost_equal(loc.tick_values(-0.1, 0.95), test_value)
38+
39+
3040
def test_LinearLocator():
3141
loc = mticker.LinearLocator(numticks=3)
3242
test_value = np.array([-0.8, -0.3, 0.2])

0 commit comments

Comments
 (0)