bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)

* Fix test_float
* Fix _osx_support
* Fix test_fstring
* Fix test_gc
* Fix test_gzip
* Fix test_hashlib
* Fix unrelated whitespace issue

Co-authored-by: Ned Deily <nad@python.org>
This commit is contained in:
Inada Naoki 2021-04-04 17:01:10 +09:00 committed by GitHub
parent f8775e4f72
commit 3caea9adda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 14 deletions

View file

@ -729,7 +729,7 @@ class FormatTestCase(unittest.TestCase):
@support.requires_IEEE_754
def test_format_testfile(self):
with open(format_testfile) as testfile:
with open(format_testfile, encoding="utf-8") as testfile:
for line in testfile:
if line.startswith('--'):
continue
@ -769,7 +769,7 @@ class FormatTestCase(unittest.TestCase):
class ReprTestCase(unittest.TestCase):
def test_repr(self):
with open(os.path.join(os.path.split(__file__)[0],
'floating_points.txt')) as floats_file:
'floating_points.txt'), encoding="utf-8") as floats_file:
for line in floats_file:
line = line.strip()
if not line or line.startswith('#'):