diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_file.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index a85e07c..cb1bdce 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -46,4 +46,15 @@ else: print "writelines accepted sequence of non-string objects" f.close() +# verify that we get a sensible error message for bad made argument +bad_mode = "qwerty" +try: + open(TESTFN, bad_mode) +except IOError, msg: + s = str(msg) + if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: + print "bad error message for invalid mode: %s" % s +else: + print "no error for invalid mode: %s" % bad_mode + os.unlink(TESTFN) |