Skip to content

Commit 4809140

Browse files
mgornyhugovk
authored andcommitted
fix expected np.arctan2() exception for numpy 1.21
NumPy 1.21 has changed the exception type for incorrect np.arctan2() arguments from ValueError to TypeError. Adjust the test appropriately. Fixes python-quantities#190
1 parent 7c243aa commit 4809140

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

quantities/tests/test_umath.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ def test_arctan2(self):
226226
np.arctan2(3*pq.V, 3*pq.V),
227227
np.radians(45)*pq.dimensionless
228228
)
229-
self.assertRaises(ValueError, np.arctan2, (1*pq.m, 1*pq.m))
229+
# NumPy <1.21 raises ValueError
230+
# NumPy >=1.21 raises TypeError
231+
self.assertRaises((TypeError, ValueError), np.arctan2, (1*pq.m, 1*pq.m))
230232

231233
def test_hypot(self):
232234
self.assertQuantityEqual(np.hypot(3 * pq.m, 4 * pq.m), 5 * pq.m)

0 commit comments

Comments
 (0)