|
1 | | -from test.support import requires_IEEE_754, cpython_only |
| 1 | +from test.support import requires_IEEE_754, cpython_only, import_helper |
2 | 2 | from test.test_math import parse_testfile, test_file |
3 | 3 | import test.test_math as test_math |
4 | 4 | import unittest |
@@ -60,7 +60,7 @@ class CMathTests(unittest.TestCase): |
60 | 60 | test_functions.append(lambda x : cmath.log(14.-27j, x)) |
61 | 61 |
|
62 | 62 | def setUp(self): |
63 | | - self.test_values = open(test_file) |
| 63 | + self.test_values = open(test_file, encoding="utf-8") |
64 | 64 |
|
65 | 65 | def tearDown(self): |
66 | 66 | self.test_values.close() |
@@ -460,13 +460,13 @@ def test_polar(self): |
460 | 460 | @cpython_only |
461 | 461 | def test_polar_errno(self): |
462 | 462 | # 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') |
464 | 464 | def polar_with_errno_set(z): |
465 | | - set_errno(11) |
| 465 | + _testcapi.set_errno(11) |
466 | 466 | try: |
467 | 467 | return polar(z) |
468 | 468 | finally: |
469 | | - set_errno(0) |
| 469 | + _testcapi.set_errno(0) |
470 | 470 | self.check_polar(polar_with_errno_set) |
471 | 471 |
|
472 | 472 | def test_phase(self): |
@@ -534,6 +534,7 @@ def test_abs(self): |
534 | 534 | self.assertEqual(abs(complex(INF, NAN)), INF) |
535 | 535 | self.assertTrue(math.isnan(abs(complex(NAN, NAN)))) |
536 | 536 |
|
| 537 | + |
537 | 538 | @requires_IEEE_754 |
538 | 539 | def test_abs_overflows(self): |
539 | 540 | # result overflows |
|
0 commit comments