diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-09-12 15:56:26 +0200 |
---|---|---|
committer | Sebastian Berg <sebastianb@nvidia.com> | 2022-10-12 10:41:40 +0200 |
commit | 0375d16f2fa8b5d8c68ef7ec641613c0a1b80658 (patch) | |
tree | a9e36852b931ae48d32d74f6a1483fb31c9cb6a3 /numpy | |
parent | d53a2b6ef0fc3380899a6a61f46507ecd6b8e419 (diff) | |
download | numpy-0375d16f2fa8b5d8c68ef7ec641613c0a1b80658.tar.gz |
TST: Add test to cover complex to complex64 downcast in weak promotion
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_nep50_promotions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/tests/test_nep50_promotions.py b/numpy/core/tests/test_nep50_promotions.py index aec3b1a61..220482dcc 100644 --- a/numpy/core/tests/test_nep50_promotions.py +++ b/numpy/core/tests/test_nep50_promotions.py @@ -123,6 +123,15 @@ def test_nep50_weak_integers_with_inexact(dtype): assert res == np.inf +def test_nep50_complex_promotion(): + np._set_promotion_state("weak") + + with pytest.warns(RuntimeWarning, match=".*overflow"): + res = np.complex64(3) + complex(2**300) + + assert type(res) == np.complex64 + + def test_nep50_integer_conversion_errors(): # Do not worry about warnings here (auto-fixture will reset). np._set_promotion_state("weak") |