Skip to content

Commit c36e361

Browse files
authored
Merge pull request #4758 from jinnarajin/hehe
update test_cmath.py from cpython 3.11.2
2 parents 8b6ef48 + c132c66 commit c36e361

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Lib/test/test_cmath.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from test.support import requires_IEEE_754, cpython_only
1+
from test.support import requires_IEEE_754, cpython_only, import_helper
22
from test.test_math import parse_testfile, test_file
33
import test.test_math as test_math
44
import unittest
@@ -60,7 +60,7 @@ class CMathTests(unittest.TestCase):
6060
test_functions.append(lambda x : cmath.log(14.-27j, x))
6161

6262
def setUp(self):
63-
self.test_values = open(test_file)
63+
self.test_values = open(test_file, encoding="utf-8")
6464

6565
def tearDown(self):
6666
self.test_values.close()
@@ -460,13 +460,13 @@ def test_polar(self):
460460
@cpython_only
461461
def test_polar_errno(self):
462462
# Issue #24489: check a previously set C errno doesn't disturb polar()
463-
from _testcapi import set_errno
463+
_testcapi = import_helper.import_module('_testcapi')
464464
def polar_with_errno_set(z):
465-
set_errno(11)
465+
_testcapi.set_errno(11)
466466
try:
467467
return polar(z)
468468
finally:
469-
set_errno(0)
469+
_testcapi.set_errno(0)
470470
self.check_polar(polar_with_errno_set)
471471

472472
def test_phase(self):
@@ -534,6 +534,7 @@ def test_abs(self):
534534
self.assertEqual(abs(complex(INF, NAN)), INF)
535535
self.assertTrue(math.isnan(abs(complex(NAN, NAN))))
536536

537+
537538
@requires_IEEE_754
538539
def test_abs_overflows(self):
539540
# result overflows

0 commit comments

Comments
 (0)