Lines Matching defs:exc
157 exc = e
158 self.assertIsInstance(exc, ExceptionGroup)
167 exc = e
169 self.assertIsInstance(exc, ExceptionGroup)
173 def assertExceptionIsLike(self, exc, template):
174 if exc is None and template is None:
178 self.fail(f"unexpected exception: {exc}")
180 if exc is None:
183 if not isinstance(exc, ExceptionGroup):
184 self.assertEqual(exc.__class__, template.__class__)
185 self.assertEqual(exc.args[0], template.args[0])
187 self.assertEqual(exc.message, template.message)
188 self.assertEqual(len(exc.exceptions), len(template.exceptions))
189 for e, t in zip(exc.exceptions, template.exceptions):
210 def doSplitTestNamed(self, exc, T, match_template, rest_template):
215 raise exc
227 def doSplitTestUnnamed(self, exc, T, match_template, rest_template):
232 raise exc
244 def doSplitTestInExceptHandler(self, exc, T, match_template, rest_template):
248 self.doSplitTestNamed(exc, T, match_template, rest_template)
249 self.doSplitTestUnnamed(exc, T, match_template, rest_template)
251 def doSplitTestInExceptStarHandler(self, exc, T, match_template, rest_template):
255 self.doSplitTestNamed(exc, T, match_template, rest_template)
256 self.doSplitTestUnnamed(exc, T, match_template, rest_template)
258 def doSplitTest(self, exc, T, match_template, rest_template):
259 self.doSplitTestNamed(exc, T, match_template, rest_template)
260 self.doSplitTestUnnamed(exc, T, match_template, rest_template)
261 self.doSplitTestInExceptHandler(exc, T, match_template, rest_template)
262 self.doSplitTestInExceptStarHandler(exc, T, match_template, rest_template)
477 exc = e
480 exc,
494 exc = e
497 exc,
511 exc = e
514 exc, ExceptionGroup("eg", [TypeError(1), OSError(3)]))
526 exc = e
529 exc, ExceptionGroup("eg", [TypeError(1)]))
542 exc = e
545 exc, ExceptionGroup("eg", [TypeError(1), OSError(3)]))
557 exc = e
560 exc, ExceptionGroup("eg", [TypeError(1), OSError(3)]))
569 exc = e
572 exc, ExceptionGroup("", [ValueError(42)]))
581 exc = e
584 exc, ExceptionGroup("", [ValueError(42)]))
596 exc = e
599 exc,
604 exc.exceptions[0].__context__,
607 self.assertMetadataNotEqual(orig, exc)
608 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
618 exc = e
621 exc,
626 exc.exceptions[0].__context__,
629 self.assertMetadataNotEqual(orig, exc)
630 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
640 exc = e
642 self.assertExceptionIsLike(exc, SyntaxError(3))
645 exc.__context__,
648 self.assertMetadataNotEqual(orig, exc)
649 self.assertMetadataEqual(orig, exc.__context__)
659 exc = e
661 self.assertExceptionIsLike(exc, SyntaxError(3))
664 exc.__context__,
667 self.assertMetadataNotEqual(orig, exc)
668 self.assertMetadataEqual(orig, exc.__context__)
680 exc = e
683 exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)]))
686 exc.exceptions[0].__context__,
690 exc.exceptions[1].__context__,
693 self.assertMetadataNotEqual(orig, exc)
694 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
695 self.assertMetadataEqual(orig, exc.exceptions[1].__context__)
707 exc = e
710 exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)]))
713 exc.exceptions[0].__context__,
717 exc.exceptions[1].__context__,
720 self.assertMetadataNotEqual(orig, exc)
721 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
722 self.assertMetadataEqual(orig, exc.exceptions[1].__context__)
734 exc = e
737 exc,
742 exc.exceptions[0].__context__,
746 exc.exceptions[0].__cause__,
749 self.assertMetadataNotEqual(orig, exc)
750 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
751 self.assertMetadataEqual(orig, exc.exceptions[0].__cause__)
752 self.assertMetadataNotEqual(orig, exc.exceptions[1].__context__)
753 self.assertMetadataNotEqual(orig, exc.exceptions[1].__cause__)
764 exc = e
767 exc,
772 exc.exceptions[0].__context__,
776 exc.exceptions[0].__cause__,
779 self.assertMetadataNotEqual(orig, exc)
780 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
781 self.assertMetadataEqual(orig, exc.exceptions[0].__cause__)
782 self.assertMetadataNotEqual(orig, exc.exceptions[1].__context__)
783 self.assertMetadataNotEqual(orig, exc.exceptions[1].__cause__)
793 exc = e
795 self.assertExceptionIsLike(exc, SyntaxError(3))
798 exc.__context__,
802 exc.__cause__,
805 self.assertMetadataNotEqual(orig, exc)
806 self.assertMetadataEqual(orig, exc.__context__)
807 self.assertMetadataEqual(orig, exc.__cause__)
818 exc = e
820 self.assertExceptionIsLike(exc, SyntaxError(3))
823 exc.__context__,
827 exc.__cause__,
830 self.assertMetadataNotEqual(orig, exc)
831 self.assertMetadataEqual(orig, exc.__context__)
832 self.assertMetadataEqual(orig, exc.__cause__)
844 exc = e
847 exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)]))
850 exc.exceptions[0].__context__,
854 exc.exceptions[0].__cause__,
858 exc.exceptions[1].__context__,
862 exc.exceptions[1].__cause__,
865 self.assertMetadataNotEqual(orig, exc)
866 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
867 self.assertMetadataEqual(orig, exc.exceptions[0].__cause__)
881 exc = e
884 exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)]))
887 exc.exceptions[0].__context__,
891 exc.exceptions[0].__cause__,
895 exc.exceptions[1].__context__,
899 exc.exceptions[1].__cause__,
902 self.assertMetadataNotEqual(orig, exc)
903 self.assertMetadataEqual(orig, exc.exceptions[0].__context__)
904 self.assertMetadataEqual(orig, exc.exceptions[0].__cause__)
905 self.assertMetadataEqual(orig, exc.exceptions[1].__context__)
906 self.assertMetadataEqual(orig, exc.exceptions[1].__cause__)
963 exc = e
965 for e in [tes, ves, exc]:
969 self.assertExceptionIsLike(exc, FalsyEG("eg", [TypeError(1)]))
986 exc = e
988 self.assertExceptionIsLike(exc, ZeroDivisionError('division by zero'))
989 self.assertExceptionIsLike(exc.__context__, ValueError(42))
1079 exc = e
1082 exc, ExceptionGroup("eg", [Bad(2), ValueError(3)]))
1185 exc = e
1188 exc, BadEG("eg", [TypeError(1),