[Python-checkins] python/dist/src/Lib/test test_csv.py, 1.27, 1.28 test_descr.py, 1.204, 1.205 test_file.py, 1.15, 1.16

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Wed Apr 20 21:41:38 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9668/Lib/test

Modified Files:
	test_csv.py test_descr.py test_file.py 
Log Message:
Fix tests dependent on the exception raised by non-settable descriptors.



Index: test_csv.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- test_csv.py	13 Jan 2005 17:37:38 -0000	1.27
+++ test_csv.py	20 Apr 2005 19:41:24 -0000	1.28
@@ -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, [])

Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- test_descr.py	3 Mar 2005 16:45:19 -0000	1.204
+++ test_descr.py	20 Apr 2005 19:41:35 -0000	1.205
@@ -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)

Index: test_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- test_file.py	31 May 2004 00:35:52 -0000	1.15
+++ test_file.py	20 Apr 2005 19:41:36 -0000	1.16
@@ -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



More information about the Python-checkins mailing list