Skip to content

Commit 01eff90

Browse files
authored
Merge pull request #2 from haval0/test-good-bad-plot
feat: add 2 tests based on good/bad plot from upstream issue
2 parents 07c43e4 + 1fc5591 commit 01eff90

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/matplotlib/tests/test_ticker.py

+20
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,26 @@ 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+
mpl.rcParams['_internal.classic_mode'] = False
253+
ll = mticker.LogLocator(subs=(1, 2, 5))
254+
test_value = np.array([1.e-01, 2.e-01, 5.e-01, 1.e+00, 2.e+00, 5.e+00,
255+
1.e+01, 2.e+01, 5.e+01, 1.e+02, 2.e+02, 5.e+02,
256+
1.e+03, 2.e+03, 5.e+03, 1.e+04, 2.e+04, 5.e+04,
257+
1.e+05, 2.e+05, 5.e+05, 1.e+06, 2.e+06, 5.e+06,
258+
1.e+07, 2.e+07, 5.e+07, 1.e+08, 2.e+08, 5.e+08,
259+
1.e+09, 2.e+09, 5.e+09])
260+
assert_array_equal(ll.tick_values(1, 1e8), test_value)
261+
242262

243263
class TestNullLocator:
244264
def test_set_params(self):

0 commit comments

Comments
 (0)