[Python-checkins] python/dist/src/Lib/test test_file.py,1.11,1.12
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Sat, 03 May 2003 21:16:53 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv30029/Lib/test
Modified Files:
test_file.py
Log Message:
Somewhere along the way, the softspace attr of file objects became read-
only. Repaired, and added new tests to test_file.py.
Index: test_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_file.py 6 Aug 2002 15:58:24 -0000 1.11
--- test_file.py 4 May 2003 04:16:50 -0000 1.12
***************
*** 6,9 ****
--- 6,29 ----
from UserList import UserList
+ # verify expected attributes exist
+ f = file(TESTFN, 'w')
+ softspace = f.softspace
+ f.name # merely shouldn't blow up
+ f.mode # ditto
+ f.closed # ditto
+
+ # verify softspace is writable
+ f.softspace = softspace # merely shouldn't blow up
+
+ # verify the others aren't
+ for attr in 'name', 'mode', 'closed':
+ try:
+ setattr(f, attr, 'oops')
+ except TypeError:
+ pass
+ else:
+ raise TestFailed('expected TypeError setting file attr %r' % attr)
+ f.close()
+
# verify writelines with instance sequence
l = UserList(['1', '2'])