diff options
| author | Brett Cannon <bcannon@gmail.com> | 2006-09-21 18:12:15 (GMT) |
|---|---|---|
| committer | Brett Cannon <bcannon@gmail.com> | 2006-09-21 18:12:15 (GMT) |
| commit | c70e003f75f40f0dcce1a7b7e02bebe16204c985 (patch) | |
| tree | 68dddc8d2063bc53687075d0570e077cdcceaffb /Lib/test/test_exceptions.py | |
| parent | 7dcdeaf1f79186a8ffd396f9d8bacebfc25724c9 (diff) | |
| download | cpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.zip cpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.tar.gz cpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.tar.bz2 | |
Backport of fix to allow exception instances to be sliced once again.
Diffstat (limited to 'Lib/test/test_exceptions.py')
| -rw-r--r-- | Lib/test/test_exceptions.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 27d88a0..345569f 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -279,6 +279,13 @@ class ExceptionTests(unittest.TestCase): '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 |
