diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-05-04 04:16:52 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-05-04 04:16:52 (GMT) |
commit | 015dd821364f8c210baa9faf9d66dc766f9b591e (patch) | |
tree | cac3e7f79348bd48f10bb8b66f174d149febe5b8 /Lib/test/test_file.py | |
parent | d72312857e985efac3127ef9eabae7d526230d69 (diff) | |
download | cpython-015dd821364f8c210baa9faf9d66dc766f9b591e.zip cpython-015dd821364f8c210baa9faf9d66dc766f9b591e.tar.gz cpython-015dd821364f8c210baa9faf9d66dc766f9b591e.tar.bz2 |
Somewhere along the way, the softspace attr of file objects became read-
only. Repaired, and added new tests to test_file.py.
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r-- | Lib/test/test_file.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index be1b2de..677dafc 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -5,6 +5,26 @@ from array import array from test.test_support import verify, TESTFN, TestFailed 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']) f = open(TESTFN, 'wb') |