[Python-checkins] r53591 - in python/trunk: Lib/test/test_exceptions.py Misc/NEWS

brett.cannon python-checkins at python.org
Mon Jan 29 05:41:45 CET 2007


Author: brett.cannon
Date: Mon Jan 29 05:41:44 2007
New Revision: 53591

Modified:
   python/trunk/Lib/test/test_exceptions.py
   python/trunk/Misc/NEWS
Log:
Add a test for slicing an exception.


Modified: python/trunk/Lib/test/test_exceptions.py
==============================================================================
--- python/trunk/Lib/test/test_exceptions.py	(original)
+++ python/trunk/Lib/test/test_exceptions.py	Mon Jan 29 05:41:44 2007
@@ -296,6 +296,13 @@
                                               'pickled "%r", attribute "%s' %
                                               (e, checkArgName))
 
+    def testSlicing(self):
+        # Test that you can slice an exception directly instead of requiring
+        # going through the 'args' attribute.
+        args = (1, 2, 3)
+        exc = BaseException(*args)
+        self.failUnlessEqual(exc[:], args)
+
     def testKeywordArgs(self):
         # test that builtin exception don't take keyword args,
         # but user-defined subclasses can if they want

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Jan 29 05:41:44 2007
@@ -403,6 +403,8 @@
 Tests
 -----
 
+- Added a test for slicing of an exception.
+
 - Added test.test_support.EnvironmentVarGuard.  It's a class that provides a
   context manager so that one can temporarily set or unset environment
   variables.


More information about the Python-checkins mailing list