summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r--Lib/test/test_file.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index af8eadf..2d2d9c1 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -40,6 +40,16 @@ for attr in 'name', 'mode', 'closed':
raise TestFailed('expected exception setting file attr %r' % attr)
f.close()
+# check invalid mode strings
+for mode in ("", "aU", "wU+"):
+ try:
+ f = file(TESTFN, mode)
+ except ValueError:
+ pass
+ else:
+ f.close()
+ raise TestFailed('%r is an invalid file mode' % mode)
+
# verify writelines with instance sequence
l = UserList(['1', '2'])
f = open(TESTFN, 'wb')