8000 Update unittest attune to numpy standards · matplotlib/matplotlib@bd6a88e · GitHub
[go: up one dir, main page]

Skip to content

Commit bd6a88e

Browse files
Update unittest attune to numpy standards
1 parent 15571fc commit bd6a88e

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lib/matplotlib/tests/test_scale.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import io
1515
import pytest
1616

17-
import random
18-
1917

2018
@check_figures_equal()
2119
def test_log_scales(fig_test, fig_ref):
@@ -60,21 +58,17 @@ def test_symlog_mask_nan():
6058
def test_symlog_linthresh():
6159
fig, ax = plt.subplots()
6260

63-
n_samples = 100
64-
65-
upper_bound = 1.0
61+
np.random.seed(19680801)
62+
x = np.random.random(100)
63+
y = np.random.random(100)
6664

67-
x = [random.uniform(0.0, upper_bound) for _ in range(n_samples)]
68-
y = [random.uniform(0.0, upper_bound) for _ in range(n_samples)]
65+
plt.plot(x, y, 'o')
66+
ax.set_xscale('symlog')
67+
ax.set_yscale('symlog')
6968

70-
with pytest.warns(UserWarning) as record:
71-
plt.plot(x, y, 'o')
72-
ax.set_xscale('symlog')
73-
ax.set_yscale('symlog')
69+
with pytest.warns(UserWarning):
7470
plt.show()
7571

76-
assert len(record) == 1
77-
7872

7973
@image_comparison(['logit_scales.png'], remove_text=True)
8074
def test_logit_scales():

0 commit comments

Comments
 (0)
0