[Python-checkins] CVS: python/dist/src/Lib/test test_file.py,1.4,1.5
Jeremy Hylton
jhylton@users.sourceforge.net
Fri, 09 Nov 2001 11:34:45 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20114
Modified Files:
test_file.py
Log Message:
Fiddle with new test cases -- verify that we get a sensible error
message for bad mode argument -- so that it doesn't fail on Windows.
It's hack. We know that errno is set to 0 in this case on Windows, so
check for that specifically.
Index: test_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_file.py 2001/11/09 16:17:09 1.4
--- test_file.py 2001/11/09 19:34:43 1.5
***************
*** 47,58 ****
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
--- 47,61 ----
f.close()
! # verify that we get a sensible error message for bad mode argument
bad_mode = "qwerty"
try:
open(TESTFN, bad_mode)
except IOError, msg:
! if msg[0] != 0:
! s = str(msg)
! if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
! print "bad error message for invalid mode: %s" % s
! # if msg[0] == 0, we're probably on Windows where there may be
! # no obvious way to discover why open() failed.
else:
print "no error for invalid mode: %s" % bad_mode