diff options
author | Skip Montanaro <skip@pobox.com> | 2005-05-20 03:07:06 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2005-05-20 03:07:06 (GMT) |
commit | bbf12ba7b20059324cf10e26aa98bc0fa405ad3d (patch) | |
tree | fde2a9dead8987c5ddffe6cab4a997322483b0ac /Lib | |
parent | 7961aa6135e5a26c1cc14bbcaa2668d2ec98b0b9 (diff) | |
download | cpython-bbf12ba7b20059324cf10e26aa98bc0fa405ad3d.zip cpython-bbf12ba7b20059324cf10e26aa98bc0fa405ad3d.tar.gz cpython-bbf12ba7b20059324cf10e26aa98bc0fa405ad3d.tar.bz2 |
Disallow opening files with modes 'aU' or 'wU' as specified by PEP
278. Closes bug 967182.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_file.py | 10 |
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') |