(self)
| 3672 | "RecursionError: maximum recursion depth exceeded", res[-1]) |
| 3673 | |
| 3674 | def test_compact_with_cause(self): |
| 3675 | try: |
| 3676 | try: |
| 3677 | 1/0 |
| 3678 | finally: |
| 3679 | cause = Exception("cause") |
| 3680 | raise Exception("uh oh") from cause |
| 3681 | except Exception as e: |
| 3682 | exc_obj = e |
| 3683 | exc = traceback.TracebackException.from_exception(exc_obj, compact=True) |
| 3684 | expected_stack = traceback.StackSummary.extract( |
| 3685 | traceback.walk_tb(exc_obj.__traceback__)) |
| 3686 | exc_cause = traceback.TracebackException(Exception, cause, None) |
| 3687 | self.assertEqual(exc_cause, exc.__cause__) |
| 3688 | self.assertEqual(None, exc.__context__) |
| 3689 | self.assertEqual(True, exc.__suppress_context__) |
| 3690 | self.assertEqual(expected_stack, exc.stack) |
| 3691 | with self.assertWarns(DeprecationWarning): |
| 3692 | self.assertEqual(type(exc_obj), exc.exc_type) |
| 3693 | self.assertEqual(type(exc_obj).__name__, exc.exc_type_str) |
| 3694 | self.assertEqual(str(exc_obj), str(exc)) |
| 3695 | |
| 3696 | def test_compact_no_cause(self): |
| 3697 | try: |
nothing calls this directly
no test coverage detected