diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-02-26 07:49:52 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-02-26 07:49:52 (GMT) |
commit | ab7bf2143e67ddc1510413fa0d7f9c621adf22fa (patch) | |
tree | 62a24ed4f57e4db638ebde745bb83e2e09fc86e3 /Lib/test/test_traceback.py | |
parent | cda6b6d60d96e6f755da92deb5e4066839095791 (diff) | |
download | cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.zip cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.tar.gz cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.tar.bz2 |
Close issue #6210: Implement PEP 409
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 4752d37..5bce2af 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -246,6 +246,21 @@ class BaseExceptionReportingTests: self.check_zero_div(blocks[0]) self.assertIn('inner_raise() # Marker', blocks[2]) + def test_context_suppression(self): + try: + try: + raise Exception + except: + raise ZeroDivisionError from None + except ZeroDivisionError as _: + e = _ + lines = self.get_report(e).splitlines() + self.assertEqual(len(lines), 4) + self.assertTrue(lines[0].startswith('Traceback')) + self.assertTrue(lines[1].startswith(' File')) + self.assertIn('ZeroDivisionError from None', lines[2]) + self.assertTrue(lines[3].startswith('ZeroDivisionError')) + def test_cause_and_context(self): # When both a cause and a context are set, only the cause should be # displayed and the context should be muted. |