Fix tests dependent on the exception raised by non-settable descriptors.
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 @@
# 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 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 @@
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