|
10 | 10 | from numpy.testing import (
|
11 | 11 | TestCase, run_module_suite, assert_, assert_equal, assert_raises,
|
12 | 12 | assert_almost_equal, assert_allclose, assert_array_equal, IS_PYPY,
|
13 |
| - suppress_warnings |
| 13 | + suppress_warnings, dec, |
14 | 14 | )
|
15 | 15 |
|
16 | 16 | types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc,
|
@@ -400,10 +400,23 @@ def overflow_error_func(dtype):
|
400 | 400 |
|
401 | 401 | def test_longdouble_int(self):
|
402 | 402 | # 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): |
403 | 413 | x = np.longdouble(np.inf)
|
404 | 414 | 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) |
407 | 420 |
|
408 | 421 | def test_numpy_scalar_relational_operators(self):
|
409 | 422 | # All integer
|
|
0 commit comments