mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
Backport of fix to allow exception instances to be sliced once again.
This commit is contained in:
parent
7dcdeaf1f7
commit
c70e003f75
3 changed files with 26 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue