Add a test for slicing an exception.

This commit is contained in:
Brett Cannon 2007-01-29 04:41:44 +00:00
parent af3d627022
commit e05e6b0032
2 changed files with 9 additions and 0 deletions

View file

@ -296,6 +296,13 @@ def testAttributes(self):
'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