Skip to content

Commit 53f0083

Browse files
committed
use cmath instead of math and remove itertools import
1 parent c1d0a00 commit 53f0083

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Lib/test/test_cmath.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from test.support.testcase import ComplexesAreIdenticalMixin
33
from test.test_math import parse_testfile, test_file
44
import test.test_math as test_math
5-
import itertools
65
import unittest
76
import cmath, math
87
from cmath import phase, polar, rect, pi
@@ -591,17 +590,17 @@ def test_complex_special(self):
591590
self.assertIsNotClose(-INF, INF)
592591
self.assertIsNotClose(0, INF)
593592
self.assertIsNotClose(0, INF*1j)
594-
special = [INF, -INF, NAN]
593+
special = [INF, -INF, NAN, 0.0, -0.0, 1.0]
595594
special_complex = [complex(x, y) for x in special for y in special]
596595

597596
nan_complex = [c for c in special_complex
598-
if math.isnan(c.real) or math.isnan(c.imag)]
597+
if cmath.isnan(c.real) or cmath.isnan(c.imag)]
599598
for z in nan_complex:
600599
for w in special_complex:
601600
self.assertIsNotClose(z, w)
602601

603602
inf_complex = [c for c in special_complex
604-
if not math.isnan(c.real) and not math.isnan(c.imag)]
603+
if not cmath.isnan(c.real) and not cmath.isnan(c.imag)]
605604
for z in inf_complex:
606605
for w in inf_complex:
607606
if z != w:

0 commit comments

Comments
 (0)