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

Skip to content

Commit 4a3df94

Browse files
committed
Simplify test
1 parent 6640e60 commit 4a3df94

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import matplotlib.pyplot as plt
1313
import matplotlib.ticker as mticker
1414

15-
import random
16-
1715

1816
class TestMaxNLocator:
1917
basic_data = [
@@ -1806,23 +1804,16 @@ def test_minorticks_on_multi_fig():
18061804
that contains more than one boxplot and shares the x-axis
18071805
should not raise an exception.
18081806
"""
1809-
fig, ax = plt.subplots(sharex=True, ncols=2, nrows=2)
1810-
1811-
def values():
1812-
return [random.random() for _ in range(9)]
1813-
1814-
for x in range(3):
1815-
ax[0, 0].boxplot(values(), positions=[x])
1816-
ax[0, 1].boxplot(values(), positions=[x])
1817-
ax[1, 0].boxplot(values(), positions=[x])
1818-
ax[1, 1].boxplot(values(), positions=[x])
1819-
1820-
for a in ax.flatten():
1821-
a.grid(which="major")
1822-
a.grid(which="minor", linestyle="--")
1823-
a.minorticks_on()
1824-
fig.canvas.draw()
1825-
1826-
assert all(a.get_xgridlines() for a in ax.flatten())
1827-
assert all((isinstance(a.xaxis.get_minor_locator(), mpl.ticker.AutoMinorLocator)
1828-
for a in ax.flatten()))
1807+
fig, ax = plt.subplots()
1808+
1809+
ax.boxplot(np.arange(10), positions=[0])
1810+
ax.boxplot(np.arange(10), positions=[0])
1811+
ax.boxplot(np.arange(10), positions=[1])
1812+
1813+
ax.grid(which="major")
1814+
ax.grid(which="minor")
1815+
ax.minorticks_on()
1816+
fig.draw_without_rendering()
1817+
1818+
assert ax.get_xgridlines()
1819+
assert isinstance(ax.xaxis.get_minor_locator(), mpl.ticker.AutoMinorLocator)

0 commit comments

Comments
 (0)