diff options
author | Barry Warsaw <barry@python.org> | 2005-04-20 19:41:36 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2005-04-20 19:41:36 (GMT) |
commit | b180c06a54a9eb0012f8102e993b9c3e8f1d7f21 (patch) | |
tree | 661a16bb6215f6dfe843d05dae351f75968e7120 | |
parent | e890682e521ad90eac91196d151b796edf00c3fa (diff) | |
download | cpython-b180c06a54a9eb0012f8102e993b9c3e8f1d7f21.zip cpython-b180c06a54a9eb0012f8102e993b9c3e8f1d7f21.tar.gz cpython-b180c06a54a9eb0012f8102e993b9c3e8f1d7f21.tar.bz2 |
Fix tests dependent on the exception raised by non-settable descriptors.
-rw-r--r-- | Lib/test/test_csv.py | 5 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 2 | ||||
-rw-r--r-- | Lib/test/test_file.py | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 2347be9..f1f183f 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -55,8 +55,9 @@ class Test_Csv(unittest.TestCase): # Try deleting or changing attributes (they are read-only) self.assertRaises(TypeError, delattr, obj.dialect, 'delimiter') self.assertRaises(TypeError, setattr, obj.dialect, 'delimiter', ':') - self.assertRaises(TypeError, delattr, obj.dialect, 'quoting') - self.assertRaises(TypeError, setattr, obj.dialect, 'quoting', None) + self.assertRaises(AttributeError, delattr, obj.dialect, 'quoting') + self.assertRaises(AttributeError, setattr, obj.dialect, + 'quoting', None) def test_reader_attrs(self): self._test_default_attrs(csv.reader, []) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 7eea465..05fd72e 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2712,7 +2712,7 @@ def setdict(): def cant(x, dict): try: x.__dict__ = dict - except TypeError: + except (AttributeError, TypeError): pass else: raise TestFailed, "shouldn't allow %r.__dict__ = %r" % (x, dict) diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index ddd0471..af8eadf 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -34,10 +34,10 @@ f.softspace = softspace # merely shouldn't blow up for attr in 'name', 'mode', 'closed': try: setattr(f, attr, 'oops') - except TypeError: + except (AttributeError, TypeError): pass else: - raise TestFailed('expected TypeError setting file attr %r' % attr) + raise TestFailed('expected exception setting file attr %r' % attr) f.close() # verify writelines with instance sequence |