forked from Rust-related/RustPython
update test_cmath.py from cpython 3.11.2
This commit is contained in:
11
Lib/test/test_cmath.py
vendored
11
Lib/test/test_cmath.py
vendored
@@ -1,4 +1,4 @@
|
||||
from test.support import requires_IEEE_754, cpython_only
|
||||
from test.support import requires_IEEE_754, cpython_only, import_helper
|
||||
from test.test_math import parse_testfile, test_file
|
||||
import test.test_math as test_math
|
||||
import unittest
|
||||
@@ -60,7 +60,7 @@ class CMathTests(unittest.TestCase):
|
||||
test_functions.append(lambda x : cmath.log(14.-27j, x))
|
||||
|
||||
def setUp(self):
|
||||
self.test_values = open(test_file)
|
||||
self.test_values = open(test_file, encoding="utf-8")
|
||||
|
||||
def tearDown(self):
|
||||
self.test_values.close()
|
||||
@@ -460,13 +460,13 @@ class CMathTests(unittest.TestCase):
|
||||
@cpython_only
|
||||
def test_polar_errno(self):
|
||||
# Issue #24489: check a previously set C errno doesn't disturb polar()
|
||||
from _testcapi import set_errno
|
||||
_testcapi = import_helper.import_module('_testcapi')
|
||||
def polar_with_errno_set(z):
|
||||
set_errno(11)
|
||||
_testcapi.set_errno(11)
|
||||
try:
|
||||
return polar(z)
|
||||
finally:
|
||||
set_errno(0)
|
||||
_testcapi.set_errno(0)
|
||||
self.check_polar(polar_with_errno_set)
|
||||
|
||||
def test_phase(self):
|
||||
@@ -534,6 +534,7 @@ class CMathTests(unittest.TestCase):
|
||||
self.assertEqual(abs(complex(INF, NAN)), INF)
|
||||
self.assertTrue(math.isnan(abs(complex(NAN, NAN))))
|
||||
|
||||
|
||||
@requires_IEEE_754
|
||||
def test_abs_overflows(self):
|
||||
# result overflows
|
||||
|
||||
Reference in New Issue
Block a user