mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133.
This commit is contained in:
parent
d91dc62379
commit
d5a1c44455
12 changed files with 80 additions and 79 deletions
|
@ -174,11 +174,14 @@ class TestCause(unittest.TestCase):
|
|||
raise ValueError from None
|
||||
except ValueError as exc:
|
||||
self.assertIsNone(exc.__cause__)
|
||||
raise exc from Ellipsis
|
||||
self.assertTrue(exc.__suppress_context__)
|
||||
exc.__suppress_context__ = False
|
||||
raise exc
|
||||
except ValueError as exc:
|
||||
e = exc
|
||||
|
||||
self.assertIs(e.__cause__, Ellipsis)
|
||||
self.assertIsNone(e.__cause__)
|
||||
self.assertFalse(e.__suppress_context__)
|
||||
self.assertIsInstance(e.__context__, TypeError)
|
||||
|
||||
def test_invalid_cause(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue