summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-04 07:36:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-04 07:36:15 (GMT)
commitbaa6efdceb61eda39cb1df7ce7bd761bc2747f08 (patch)
treeb77c9f4cd3da734b3f2cd040ef28fcd3e1cd85ec
parent37943b07fe6a76a4cda189b9772d57dab7839311 (diff)
downloadcpython-baa6efdceb61eda39cb1df7ce7bd761bc2747f08.zip
cpython-baa6efdceb61eda39cb1df7ce7bd761bc2747f08.tar.gz
cpython-baa6efdceb61eda39cb1df7ce7bd761bc2747f08.tar.bz2
Open files in binary mode to avoid newlines transformation.
-rw-r--r--Lib/test/test_doctest.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 61c7ba7..c1e4c13 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2580,7 +2580,7 @@ Windows line endings first:
>>> import tempfile, os
>>> fn = tempfile.mktemp()
- >>> with open(fn, 'w') as f:
+ >>> with open(fn, 'wb') as f:
... f.write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)
@@ -2589,7 +2589,7 @@ Windows line endings first:
And now *nix line endings:
>>> fn = tempfile.mktemp()
- >>> with open(fn, 'w') as f:
+ >>> with open(fn, 'wb') as f:
... f.write('Test:\n\n >>> x = 1 + 1\n\nDone.\n')
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)