summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-04-02 03:53:46 (GMT)
committerGitHub <noreply@github.com>2021-04-02 03:53:46 (GMT)
commit8bbfeb3330c10d52274bb85fce59ae614f0500bf (patch)
treee599878998ff1f8b1cf61bce14ff2a2037871a87 /Lib/test/test_doctest.py
parentbef7b26f7229f8b7cde843118a7bc7e2b00f0372 (diff)
downloadcpython-8bbfeb3330c10d52274bb85fce59ae614f0500bf.zip
cpython-8bbfeb3330c10d52274bb85fce59ae614f0500bf.tar.gz
cpython-8bbfeb3330c10d52274bb85fce59ae614f0500bf.tar.bz2
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)
* test__xxsubinterpreters * test_builtin * test_doctest * test_exceptions * test_opcodes * test_support * test_argparse * test_baseexception * test_bdb * test_bool * test_asdl_parser
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r--Lib/test/test_doctest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 6a5013f..6f51b1b 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2846,7 +2846,7 @@ the verbose version, and then check the output:
>>> from test.support.os_helper import temp_dir
>>> with temp_dir() as tmpdir:
... fn = os.path.join(tmpdir, 'myfile.doc')
- ... with open(fn, 'w') as f:
+ ... with open(fn, 'w', encoding='utf-8') as f:
... _ = f.write('This is a very simple test file.\n')
... _ = f.write(' >>> 1 + 1\n')
... _ = f.write(' 2\n')
@@ -2898,7 +2898,7 @@ text files).
>>> from test.support.os_helper import temp_dir
>>> with temp_dir() as tmpdir:
... fn = os.path.join(tmpdir, 'myfile.doc')
- ... with open(fn, 'w') as f:
+ ... with open(fn, 'w', encoding="utf-8") as f:
... _ = f.write('This is another simple test file.\n')
... _ = f.write(' >>> 1 + 1\n')
... _ = f.write(' 2\n')
@@ -2909,7 +2909,7 @@ text files).
... _ = f.write('\n')
... _ = f.write('And that is it.\n')
... fn2 = os.path.join(tmpdir, 'myfile2.py')
- ... with open(fn2, 'w') as f:
+ ... with open(fn2, 'w', encoding='utf-8') as f:
... _ = f.write('def test_func():\n')
... _ = f.write(' \"\"\"\n')
... _ = f.write(' This is simple python test function.\n')