summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-01-29 04:41:44 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-01-29 04:41:44 (GMT)
commite05e6b0032a58fe5e4ff3b2b9b64c6e37da4defa (patch)
treef5e02fc61f9ed3565b238afac9b4d3b92ceef55f /Lib/test/test_exceptions.py
parentaf3d627022dcd0948610228b231106a198ed7bd8 (diff)
downloadcpython-e05e6b0032a58fe5e4ff3b2b9b64c6e37da4defa.zip
cpython-e05e6b0032a58fe5e4ff3b2b9b64c6e37da4defa.tar.gz
cpython-e05e6b0032a58fe5e4ff3b2b9b64c6e37da4defa.tar.bz2
Add a test for slicing an exception.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index b0e872b..b99e247 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -296,6 +296,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