Skip to content

Commit 36adb34

Browse files
committed
Fix tests
1 parent 737aa02 commit 36adb34

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6419,8 +6419,8 @@ def test_auto_numticks_log():
64196419
fig, ax = plt.subplots()
64206420
mpl.rcParams['axes.autolimit_mode'] = 'round_numbers'
64216421
ax.loglog([1e-20, 1e5], [1e-16, 10])
6422-
assert (np.log10(ax.get_xticks()) == np.arange(-26, 18, 4)).all()
6423-
assert (np.log10(ax.get_yticks()) == np.arange(-20, 10, 3)).all()
6422+
assert_array_equal(np.log10(ax.get_xticks()), np.arange(-22, 14, 4))
6423+
assert_array_equal(np.log10(ax.get_yticks()), np.arange(-17, 7, 3))
64246424

64256425

64266426
def test_broken_barh_empty():

lib/matplotlib/tests/test_colorbar.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,10 @@ def test_colorbar_autotickslog():
493493
orientation='vertical', shrink=0.4)
494494
# note only -12 to +12 are visible
495495
np.testing.assert_almost_equal(cbar.ax.yaxis.get_ticklocs(),
496-
10**np.arange(-16., 16.2, 4.))
497-
# note only -24 to +24 are visible
496+
10**np.arange(-12., 12.2, 4.))
497+
# note only -12 to +12 are visible
498498
np.testing.assert_almost_equal(cbar2.ax.yaxis.get_ticklocs(),
499-
10**np.arange(-24., 25., 12.))
499+
10**np.arange(-12., 13., 12.))
500500

501501

502502
def test_colorbar_get_ticks():
@@ -584,6 +584,7 @@ def test_colorbar_log_minortick_labels():
584584
def test_colorbar_renorm():
585585
x, y = np.ogrid[-4:4:31j, -4:4:31j]
586586
z = 120000*np.exp(-x**2 - y**2)
587+
# min/max of z vals is 1.5196998658913011e-09, 120000.0
587588

588589
fig, ax = plt.subplots()
589590
im = ax.imshow(z)
@@ -597,7 +598,7 @@ def test_colorbar_renorm():
597598
norm = LogNorm(z.min(), z.max())
598599
im.set_norm(norm)
599600
np.testing.assert_allclose(cbar.ax.yaxis.get_majorticklocs(),
600-
np.logspace(-10, 7, 18))
601+
np.logspace(-9, 6, 16))
601602
# note that set_norm removes the FixedLocator...
602603
assert np.isclose(cbar.vmin, z.min())
603604
cbar.set_ticks([1, 2, 3])
@@ -616,6 +617,7 @@ def test_colorbar_format(fmt):
616617
# make sure that format is passed properly
617618
x, y = np.ogrid[-4:4:31j, -4:4:31j]
618619
z = 120000*np.exp(-x**2 - y**2)
620+
# min/max of z vals is 1.5196998658913011e-09, 120000.0
619621

620622
fig, ax = plt.subplots()
621623
im = ax.imshow(z)
@@ -633,7 +635,7 @@ def test_colorbar_format(fmt):
633635
im.set_norm(LogNorm(vmin=0.1, vmax=10))
634636
fig.canvas.draw()
635637
assert (cbar.ax.yaxis.get_ticklabels()[0].get_text() ==
636-
'$\\mathdefault{10^{-2}}$')
638+
'$\\mathdefault{10^{-1}}$')
637639

638640

639641
def test_colorbar_scale_reset():

lib/matplotlib/tests/test_ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_polar_axes(self):
235235
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
236236
ax.set_yscale('log')
237237
ax.set_ylim(1, 100)
238-
assert_array_equal(ax.get_yticks(), [10, 100, 1000])
238+
assert_array_equal(ax.get_yticks(), [10, 100])
239239

240240
def test_switch_to_autolocator(self):
241241
loc = mticker.LogLocator(subs="all")

0 commit comments

Comments
 (0)