Browse Source
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126)
pull/25146/head
Inada Naoki
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
3 deletions
-
Lib/test/test_warnings/__init__.py
|
|
|
@ -935,10 +935,10 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase): |
|
|
|
def test_tracemalloc(self): |
|
|
|
self.addCleanup(os_helper.unlink, os_helper.TESTFN) |
|
|
|
|
|
|
|
with open(os_helper.TESTFN, 'w') as fp: |
|
|
|
with open(os_helper.TESTFN, 'w', encoding="utf-8") as fp: |
|
|
|
fp.write(textwrap.dedent(""" |
|
|
|
def func(): |
|
|
|
f = open(__file__) |
|
|
|
f = open(__file__, "rb") |
|
|
|
# Emit ResourceWarning |
|
|
|
f = None |
|
|
|
|
|
|
|
@ -973,7 +973,7 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase): |
|
|
|
File "{filename}", lineno 7 |
|
|
|
func() |
|
|
|
File "{filename}", lineno 3 |
|
|
|
f = open(__file__) |
|
|
|
f = open(__file__, "rb") |
|
|
|
''').strip() |
|
|
|
self.assertEqual(stderr, expected) |
|
|
|
|
|
|
|
|