Skip to content

Commit 63bbe77

Browse files
authored
gh-109802: Add coverage test for complex_abs() (GH-117449)
* gh-109802: Add coverage test for complex_abs() This tests overflow on L594. // line numbers wrt to 0f2fa61
1 parent df912c9 commit 63bbe77

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/test/test_complex.py

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
INF = float("inf")
1212
NAN = float("nan")
13+
DBL_MAX = sys.float_info.max
1314
# These tests ensure that complex math does the right thing
1415

1516
ZERO_DIVISION = (
@@ -597,6 +598,8 @@ def test_abs(self):
597598
for num in nums:
598599
self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num))
599600

601+
self.assertRaises(OverflowError, abs, complex(DBL_MAX, DBL_MAX))
602+
600603
def test_repr_str(self):
601604
def test(v, expected, test_fn=self.assertEqual):
602605
test_fn(repr(v), expected)

0 commit comments

Comments
 (0)