|
24 | 24 | from numpy import all as alltrue |
25 | 25 | from numpy import (allclose, arange, arccos, arccosh, arcsin, arcsinh, arctan, |
26 | 26 | arctan2, arctanh, array, array_equal, cdouble, ceil, conj, |
27 | | - copy, cos, cosh, empty, exp, expm1, float64, floor, fmod, |
28 | | - hypot, int32, int64, isinf, isnan, linspace, log, log1p, |
29 | | - log2, log10, nextafter, ones_like, prod, ravel, rec, round, |
30 | | - shape, sin, sinh, sqrt, sum, tan, tanh, trunc, uint16, |
31 | | - where, zeros) |
| 27 | + copy, copysign, cos, cosh, empty, exp, expm1, float64, |
| 28 | + floor, fmod, hypot, int32, int64, isfinite, isinf, isnan, |
| 29 | + linspace, log, log1p, log2, log10, nextafter, ones_like, |
| 30 | + prod, ravel, rec, round, shape, signbit, sin, sinh, sqrt, |
| 31 | + sum, tan, tanh, trunc, uint16, where, zeros) |
32 | 32 | from numpy.testing import (assert_allclose, assert_array_almost_equal, |
33 | 33 | assert_array_equal, assert_equal) |
34 | 34 |
|
@@ -728,20 +728,26 @@ def test_bool_funcs(self): |
728 | 728 | a = np.arange(2 * array_size, dtype=dtype) |
729 | 729 | a[array_size//2] = np.nan |
730 | 730 | a[array_size//3] = np.inf |
| 731 | + a[array_size//4] = -2 |
| 732 | + |
| 733 | + assert_equal(evaluate("isnan(a)"), isnan(a)) |
| 734 | + assert_equal(evaluate("isfinite(a)"), isfinite(a)) |
| 735 | + assert_equal(evaluate("isinf(a)"), isinf(a)) |
| 736 | + assert_equal(evaluate("signbit(a)"), signbit(a)) |
731 | 737 |
|
732 | | - assert np.all(evaluate("isnan(a)") == np.isnan(a)) |
733 | | - assert np.all(evaluate("isfinite(a)") == np.isfinite(a)) |
734 | | - assert np.all(evaluate("isinf(a)") == np.isinf(a)) |
735 | 738 | a = a.astype(np.float64) |
736 | 739 | assert a.dtype == np.float64 |
737 | | - assert np.all(evaluate("isnan(a)") == np.isnan(a)) |
738 | | - assert np.all(evaluate("isfinite(a)") == np.isfinite(a)) |
739 | | - assert np.all(evaluate("isinf(a)") == np.isinf(a)) |
| 740 | + assert_equal(evaluate("isnan(a)"), isnan(a)) |
| 741 | + assert_equal(evaluate("isfinite(a)"), isfinite(a)) |
| 742 | + assert_equal(evaluate("isinf(a)"), isinf(a)) |
| 743 | + assert_equal(evaluate("signbit(a)"), signbit(a)) |
| 744 | + |
740 | 745 | a = a.astype(np.complex128) |
741 | 746 | assert a.dtype == np.complex128 |
742 | 747 | assert np.all(evaluate("isnan(a)") == np.isnan(a)) |
743 | 748 | assert np.all(evaluate("isfinite(a)") == np.isfinite(a)) |
744 | 749 | assert np.all(evaluate("isinf(a)") == np.isinf(a)) |
| 750 | + # signbit not defined for complex numbers |
745 | 751 |
|
746 | 752 | if 'sparc' not in platform.machine(): |
747 | 753 | # Execution order set here so as to not use too many threads |
@@ -814,7 +820,7 @@ def test_changing_nthreads_01_dec(self): |
814 | 820 | tests.append(('1_ARG_FUNCS', func1tests)) |
815 | 821 |
|
816 | 822 | func2tests = [] |
817 | | -for func in ['arctan2', 'fmod', 'hypot', 'nextafter']: |
| 823 | +for func in ['arctan2', 'fmod', 'hypot', 'nextafter', 'copysign']: |
818 | 824 | func2tests.append("a + %s(b+c, d+1)" % func) |
819 | 825 | func2tests.append("a + %s(b+c, 1)" % func) |
820 | 826 | func2tests.append("a + %s(1, d+1)" % func) |
|
0 commit comments