Skip to content

Commit

Permalink
TST: Add test to cover complex to complex64 downcast in weak promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
seberg committed Sep 12, 2022
1 parent f096789 commit fb136f8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions numpy/core/tests/test_nep50_promotions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ 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")
Expand Down

0 comments on commit fb136f8

Please sign in to comment.