|
1 | | -import warnings |
2 | 1 | import numpy as np |
3 | 2 | import pytest |
4 | 3 | import sys |
@@ -72,29 +71,25 @@ def test_quiver_arg_sizes(): |
72 | 71 | plt.quiver(X2, X2, X2, X2, X3) |
73 | 72 |
|
74 | 73 |
|
75 | | -def test_no_warnings(): |
| 74 | +def test_no_warnings(recwarn): |
76 | 75 | fig, ax = plt.subplots() |
77 | | - |
78 | 76 | X, Y = np.meshgrid(np.arange(15), np.arange(10)) |
79 | 77 | U = V = np.ones_like(X) |
80 | | - |
81 | 78 | phi = (np.random.rand(15, 10) - .5) * 150 |
82 | | - with warnings.catch_warnings(record=True) as w: |
83 | | - ax.quiver(X, Y, U, V, angles=phi) |
84 | | - fig.canvas.draw() |
85 | | - assert len(w) == 0 |
| 79 | + ax.quiver(X, Y, U, V, angles=phi) |
| 80 | + fig.canvas.draw() |
| 81 | + assert len(recwarn) == 0 |
86 | 82 |
|
87 | 83 |
|
88 | | -def test_zero_headlength(): |
| 84 | +def test_zero_headlength(recwarn): |
89 | 85 | # Based on report by Doug McNeil: |
90 | 86 | # http://matplotlib.1069221.n5.nabble.com/quiver-warnings-td28107.html |
91 | 87 | fig, ax = plt.subplots() |
92 | 88 | X, Y = np.meshgrid(np.arange(10), np.arange(10)) |
93 | 89 | U, V = np.cos(X), np.sin(Y) |
94 | | - with warnings.catch_warnings(record=True) as w: |
95 | | - ax.quiver(U, V, headlength=0, headaxislength=0) |
96 | | - fig.canvas.draw() |
97 | | - assert len(w) == 0 |
| 90 | + ax.quiver(U, V, headlength=0, headaxislength=0) |
| 91 | + fig.canvas.draw() |
| 92 | + assert len(recwarn) == 0 |
98 | 93 |
|
99 | 94 |
|
100 | 95 | @image_comparison(['quiver_animated_test_image.png']) |
|
0 commit comments