summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-04 07:36:50 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-04 07:36:50 (GMT)
commitae2d667ae83548029fed7244619fadd7f625cb24 (patch)
tree4c9ee2f212497cadfce62eb01423ee2ab5bc9f29 /Lib
parent778db289b5a1968c67db195572f2384489cca20c (diff)
parentc9ba38c21c9a7ba9e26cdfaee7f6e201f561222e (diff)
downloadcpython-ae2d667ae83548029fed7244619fadd7f625cb24.zip
cpython-ae2d667ae83548029fed7244619fadd7f625cb24.tar.gz
cpython-ae2d667ae83548029fed7244619fadd7f625cb24.tar.bz2
Open files in binary mode to avoid newlines transformation.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_doctest.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 95700a3..665272f 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2644,8 +2644,8 @@ Windows line endings first:
>>> import tempfile, os
>>> fn = tempfile.mktemp()
- >>> with open(fn, 'w') as f:
- ... f.write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
+ >>> with open(fn, 'wb') as f:
+ ... f.write(b'Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
35
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)
@@ -2654,8 +2654,8 @@ Windows line endings first:
And now *nix line endings:
>>> fn = tempfile.mktemp()
- >>> with open(fn, 'w') as f:
- ... f.write('Test:\n\n >>> x = 1 + 1\n\nDone.\n')
+ >>> with open(fn, 'wb') as f:
+ ... f.write(b'Test:\n\n >>> x = 1 + 1\n\nDone.\n')
30
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)