summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2021-05-14 12:51:52 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2021-05-14 12:52:11 -0700
commit23dad3aae724fc748dc19d0f6501d5795f87583a (patch)
tree8c0c5e7ccccf6ecdaf5ec47d0db907de849b5d02
parent7e6bcfc00e840a5b894a029f73160fc873fc7931 (diff)
downloadnumpy-23dad3aae724fc748dc19d0f6501d5795f87583a.tar.gz
TST: Add complex-complex promotions to test parametrization
-rw-r--r--numpy/core/tests/test_dtype.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py
index 3625c2f62..01c865d59 100644
--- a/numpy/core/tests/test_dtype.py
+++ b/numpy/core/tests/test_dtype.py
@@ -1102,6 +1102,13 @@ class TestPromotion:
(np.longdouble(np.nextafter(1.7e308, 0.)), np.complex128),
# Additionally use "nextafter" so the cast can't round down:
(np.longdouble(np.nextafter(1.7e308, np.inf)), np.clongdouble),
+ # repeat for complex scalars:
+ (np.complex64(2), np.complex64),
+ (np.clongdouble(2), np.complex64),
+ # Base of the double value to sidestep any rounding issues:
+ (np.clongdouble(np.nextafter(1.7e308, 0.) * 1j), np.complex128),
+ # Additionally use "nextafter" so the cast can't round down:
+ (np.clongdouble(np.nextafter(1.7e308, np.inf)), np.clongdouble),
])
def test_complex_other_value_based(self, other, expected):
# This would change if we modify the value based promotion
@@ -1120,6 +1127,9 @@ class TestPromotion:
(np.float32, np.complex64),
(np.float64, np.complex128),
(np.longdouble, np.clongdouble),
+ (np.complex64, np.complex64),
+ (np.complex128, np.complex128),
+ (np.clongdouble, np.clongdouble),
])
def test_complex_scalar_value_based(self, other, expected):
# This would change if we modify the value based promotion