8000 bpo-43651: PEP 597: Fix EncodingWarning in some tests by methane · Pull Request #25145 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

bpo-43651: PEP 597: Fix EncodingWarning in some tests #25145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Apr 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test_math, test_cmath
  • Loading branch information
methane committed Apr 2, 2021
commit ff78771d21ac6c7c8cbb3ca46f2a66bb02131d2a
2 changes: 1 addition & 1 deletion Lib/test/test_cmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def parse_mtestfile(fname):
id fn arg -> expected [flag]*

"""
with open(fname) as fp:
with open(fname, encoding="utf-8") as fp:
for line in fp:
# strip comments, and skip blank lines
if '--' in line:
Expand All @@ -153,7 +153,7 @@ def parse_testfile(fname):
Empty lines or lines starting with -- are ignored
yields id, fn, arg_real, arg_imag, exp_real, exp_imag
"""
with open(fname) as fp:
with open(fname, encoding="utf-8") as fp:
for line in fp:
# skip comment lines and blank lines
if line.startswith('--') or not line.strip():
Expand Down
0