8000 Merge pull request #9181 from mattip/master · numpy/numpy@39117c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39117c5

Browse files
authored
Merge pull request #9181 from mattip/master
COMPAT: PyPy calls clongdouble_int which raises a warning
2 parents c556b42 + dc1d1d5 commit 39117c5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

numpy/core/tests/test_scalarmath.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from numpy.testing import (
1111
TestCase, run_module_suite, assert_, assert_equal, assert_raises,
1212
assert_almost_equal, assert_allclose, assert_array_equal, IS_PYPY,
13-
suppress_warnings
13+
suppress_warnings, dec,
1414
)
1515

1616
types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc,
@@ -400,10 +400,23 @@ def overflow_error_func(dtype):
400400

401401
def test_longdouble_int(self):
402402
# gh-627
403+
x = np.longdouble(np.inf)
404+
assert_raises(OverflowError, int, x)
405+
with suppress_warnings() as sup:
406+
sup.record(np.ComplexWarning)
407+
x = np.clongdouble(np.inf)
408+
assert_raises(OverflowError, int, x)
409+
self.assertEqual(len(sup.log), 1)
410+
411+
@dec.knownfailureif(not IS_PYPY)
412+
def test_clongdouble___int__(self):
403413
x = np.longdouble(np.inf)
404414
assert_raises(OverflowError, x.__int__)
405-
x = np.clongdouble(np.inf)
406-
assert_raises(OverflowError, x.__int__)
415+
with suppress_warnings() as sup:
416+
sup.record(np.ComplexWarning)
417+
x = np.clongdouble(np.inf)
418+
assert_raises(OverflowError, x.__int__)
419+
self.assertEqual(len(sup.log), 1)
407420

408421
def test_numpy_scalar_relational_operators(self):
409422
# All integer

0 commit comments

Comments
 (0)
0