[Python-checkins] python/dist/src/Lib/test test_file.py,1.16,1.17

montanaro@users.sourceforge.net montanaro at users.sourceforge.net
Fri May 20 05:07:23 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22227/Lib/test

Modified Files:
	test_file.py 
Log Message:
Disallow opening files with modes 'aU' or 'wU' as specified by PEP
278. Closes bug 967182.


Index: test_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_file.py	20 Apr 2005 19:41:36 -0000	1.16
+++ test_file.py	20 May 2005 03:07:04 -0000	1.17
@@ -40,6 +40,16 @@
         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')



More information about the Python-checkins mailing list