8000 feat: add 2 tests based on good/bad plot from upstream issue · matplotlib/matplotlib@da5796c · GitHub
[go: up one dir, main page]

Skip to content

Commit da5796c

Browse files
committed
feat: add 2 tests based on good/bad plot from upstream issue
The test cases are based on the demonstration of the issue in upstream issue #24092 The test case for bad plot (test_tick_values_not_empty) should fail until we implement our fix. The test case for good plot (test_tick_values_correct) should already suceed and continue to succeed after we implement our fix.
1 parent 07c43e4 commit da5796c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,25 @@ def test_set_params(self):
239239
assert loc._base == 4
240240
assert list(loc._subs) == [2.0]
241241

242+
def test_tick_values_correct(self):
243+
ll = mticker.LogLocator(subs=(1, 2, 5))
244+
test_value = np.array([1.e-01, 2.e-01, 5.e-01, 1.e+00, 2.e+00, 5.e+00,
245+
1.e+01, 2.e+01, 5.e+01, 1.e+02, 2.e+02, 5.e+02,
246+
1.e+03, 2.e+03, 5.e+03, 1.e+04, 2.e+04, 5.e+04,
247+
1.e+05, 2.e+05, 5.e+05, 1.e+06, 2.e+06, 5.e+06,
248+
1.e+07, 2.e+07, 5.e+07, 1.e+08, 2.e+08, 5.e+08])
249+
assert_array_equal(ll.tick_values(1, 1e7), test_value)
250+
251+
def test_tick_values_not_empty(self):
252+
ll = mticker.LogLocator(subs=(1, 2, 5))
253+
test_value = np.array([1.e-01, 2.e-01, 5.e-01, 1.e+00, 2.e+00, 5.e+00,
254+
1.e+01, 2.e+01, 5.e+01, 1.e+02, 2.e+02, 5.e+02,
255+
1.e+03, 2.e+03, 5.e+03, 1.e+04, 2.e+04, 5.e+04,
256+
1.e+05, 2.e+05, 5.e+05, 1.e+06, 2.e+06, 5.e+06,
257+
1.e+07, 2.e+07, 5.e+07, 1.e+08, 2.e+08, 5.e+08,
258+
1.e+09, 2.e+09, 5.e+09])
259+
assert_array_equal(ll.tick_values(1, 1e8), test_value)
260+
242261

243262
class TestNullLocator:
244263
def test_set_params(self):

0 commit comments

Comments
 (0)
0