(self)
| 3950 | @unittest.expectedFailure # TODO: RUSTPYTHON; ? ^ + |
| 3951 | @requires_debug_ranges() |
| 3952 | def test_print(self): |
| 3953 | def f(): |
| 3954 | x = 12 |
| 3955 | try: |
| 3956 | x/0 |
| 3957 | except Exception as e: |
| 3958 | return e |
| 3959 | exc = traceback.TracebackException.from_exception(f(), capture_locals=True) |
| 3960 | output = StringIO() |
| 3961 | exc.print(file=output) |
| 3962 | self.assertEqual( |
| 3963 | output.getvalue().split('\n')[-5:], |
| 3964 | [' x/0', |
| 3965 | ' ~^~', |
| 3966 | ' x = 12', |
| 3967 | 'ZeroDivisionError: division by zero', |
| 3968 | '']) |
| 3969 | |
| 3970 | def test_dont_swallow_cause_or_context_of_falsey_exception(self): |
| 3971 | # see gh-132308: Ensure that __cause__ or __context__ attributes of exceptions |
nothing calls this directly
no test coverage detected