Commit e05e6b00 authored by Brett Cannon's avatar Brett Cannon

Add a test for slicing an exception.

parent af3d6270
......@@ -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
......
......@@ -403,6 +403,8 @@ Extension Modules
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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment