summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_file.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-11-27 20:37:43 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-11-27 20:37:43 (GMT)
commitfcf4435ae02c3962a8ad71a9539877060c694468 (patch)
tree66b05ecac0df3d4105c15ee62f6ea8b520e87312 /Lib/test/test_file.py
parent307021f40b227d2bf114b536c37cc41e03fc2aff (diff)
downloadcpython-fcf4435ae02c3962a8ad71a9539877060c694468.zip
cpython-fcf4435ae02c3962a8ad71a9539877060c694468.tar.gz
cpython-fcf4435ae02c3962a8ad71a9539877060c694468.tar.bz2
Improve test coverage. Hope the test_file changes work the same on windows.
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r--Lib/test/test_file.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 2d2d9c1..2869ce7 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -100,6 +100,39 @@ else:
print "writelines accepted sequence of non-string objects"
f.close()
+try:
+ sys.stdin.seek(0)
+except IOError:
+ pass
+else:
+ print "should not be able to seek on sys.stdin"
+
+try:
+ sys.stdin.tell()
+except IOError:
+ pass
+else:
+ print "should not be able to seek on sys.stdin"
+
+try:
+ sys.stdin.truncate()
+except IOError:
+ pass
+else:
+ print "should not be able to truncate on sys.stdin"
+
+# verify repr works
+f = open(TESTFN)
+if not repr(f).startswith("<open file '" + TESTFN):
+ print "repr(file) failed"
+f.close()
+
+# verify repr works for unicode too
+f = open(unicode(TESTFN))
+if not repr(f).startswith("<open file u'" + TESTFN):
+ print "repr(file with unicode name) failed"
+f.close()
+
# verify that we get a sensible error message for bad mode argument
bad_mode = "qwerty"
try: