Skip to content

Commit c991da1

Browse files
committed
TST : minor changes to tests
- don't use pylab - add @clean up to not leak to other tests The minor tick locator needs to be attached to an axis object (as it depends on where the major ticks are to sort out where the minor ticks) so it is easiest to just make a figure/axes and test on that.
1 parent c9b14f6 commit c991da1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from numpy.testing import assert_almost_equal
88
import numpy as np
99
import matplotlib
10-
10+
import matplotlib.pyplot as plt
1111
import matplotlib.ticker as mticker
12-
12+
from matplotlib.testing.decorators import cleanup
1313

1414
def test_MaxNLocator():
1515
loc = mticker.MaxNLocator(nbins=5)
@@ -36,10 +36,9 @@ def test_MultipleLocator():
3636
assert_almost_equal(loc.tick_values(-7, 10), test_value)
3737

3838

39+
@cleanup
3940
def test_AutoMinorLocator():
40-
from pylab import figure
41-
fig = figure()
42-
ax = fig.add_subplot(111)
41+
fig, ax = plt.subplots()
4342
ax.set_xlim(0, 1.39)
4443
ax.minorticks_on()
4544
test_value = np.array([0.05, 0.1, 0.15, 0.25, 0.3, 0.35, 0.45,

0 commit comments

Comments
 (0)