summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-19 21:22:10 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-02-19 21:22:10 (GMT)
commit4d7cad115d063c26f56f577eb0e650edaa285798 (patch)
tree614ae3f7218a69acbda6b3aefc343b52b63fab74 /Lib/test
parent6302a5a9b0eb29d244d08e3e6f4f6668fc011f2f (diff)
downloadcpython-4d7cad115d063c26f56f577eb0e650edaa285798.zip
cpython-4d7cad115d063c26f56f577eb0e650edaa285798.tar.gz
cpython-4d7cad115d063c26f56f577eb0e650edaa285798.tar.bz2
Repair new test failures on Windows due to
implicit assumptions that there's no difference between text and binary modes.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_fileinput.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index ff3fc24..f3a7841 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -15,9 +15,9 @@ from fileinput import FileInput, hook_encoded
# Write lines (a list of lines) to temp file number i, and return the
# temp file's name.
-def writeTmp(i, lines):
+def writeTmp(i, lines, mode='w'): # opening in text mode is the default
name = TESTFN + str(i)
- f = open(name, 'w')
+ f = open(name, mode)
f.writelines(lines)
f.close()
return name
@@ -194,7 +194,7 @@ except ValueError:
pass
try:
# try opening in universal newline mode
- t1 = writeTmp(1, ["A\nB\r\nC\rD"])
+ t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb")
fi = FileInput(files=t1, mode="U")
lines = list(fi)
verify(lines == ["A\n", "B\n", "C\n", "D"])
@@ -216,7 +216,7 @@ try:
except ValueError:
pass
try:
- t1 = writeTmp(1, ["A\nB"])
+ t1 = writeTmp(1, ["A\nB"], mode="wb")
fi = FileInput(files=t1, openhook=hook_encoded("rot13"))
lines = list(fi)
verify(lines == ["N\n", "O"])