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

Skip to content

Commit 17db319

Browse files
committed
Remove randomness from test_colorbar_get_ticks_2.
The point of the test is to check that colorbar ticks have certain values when the scalarmappable's lower and upper lims are a bit more than 0 and a bit less than 1, respectively. Certainly sampling 30x30 random values will nearly always accomplish this, but we may as well just enforce the values.
1 parent fbbc84f commit 17db319

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/matplotlib/tests/test_colorbar.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,13 +534,11 @@ def test_colorbar_scale_reset():
534534

535535

536536
def test_colorbar_get_ticks_2():
537-
with rc_context({'_internal.classic_mode': False}):
538-
539-
fig, ax = plt.subplots()
540-
np.random.seed(19680801)
541-
pc = ax.pcolormesh(np.random.rand(30, 30))
542-
cb = fig.colorbar(pc)
543-
np.testing.assert_allclose(cb.get_ticks(), [0.2, 0.4, 0.6, 0.8])
537+
plt.rcParams['_internal.classic_mode'] = False
538+
fig, ax = plt.subplots()
539+
pc = ax.pcolormesh([[.05, .95]])
540+
cb = fig.colorbar(pc)
541+
np.testing.assert_allclose(cb.get_ticks(), [0.2, 0.4, 0.6, 0.8])
544542

545543

546544
def test_colorbar_inverted_ticks():

0 commit comments

Comments
 (0)