Lines Matching refs:match
334 with self.subTest(match=match_type):
367 match, rest = self.eg.split(E)
369 match, ExceptionGroup, self.eg_template)
373 match, rest = self.eg.split(OSError)
374 self.assertIsNone(match)
391 match, rest = eg.split(match_type)
392 self.assertEqual(match.message, eg.message)
394 match, ExceptionGroup, match_template)
403 match, rest = self.eg.split(lambda e: True)
404 self.assertMatchesTemplate(match, ExceptionGroup, self.eg_template)
408 match, rest = self.eg.split(lambda e: False)
409 self.assertIsNone(match)
424 match, rest = eg.split(lambda e: isinstance(e, match_type))
425 self.assertEqual(match.message, eg.message)
427 match, ExceptionGroup, match_template)
557 match, rest = eg.split(types)
560 if match is not None:
561 self.assertIsInstance(match, BaseExceptionGroup)
562 for e,_ in leaf_generator(match):
576 # match and subgroup have the same leaves
577 self.assertSequenceEqual(leaves(match), leaves(sg))
579 match_leaves = leaves(match)
581 # each leaf exception of eg is in exactly one of match and rest
584 len(leaves(match)) + len(leaves(rest)))
588 match and e in match_leaves,
592 for part in [match, rest, sg]:
610 # full tracebacks match
611 for part in [match, rest, sg]:
617 return match, rest
689 match, rest = self.split_exception_group(eg, SyntaxError)
690 self.assertIsNone(match)
694 match, rest = self.split_exception_group(eg, BaseException)
695 self.assertMatchesTemplate(match, ExceptionGroup, eg_template)
697 match, rest = self.split_exception_group(eg, (ValueError, TypeError))
698 self.assertMatchesTemplate(match, ExceptionGroup, eg_template)
702 match, rest = self.split_exception_group(eg, ValueError)
703 self.assertMatchesTemplate(match, ExceptionGroup, valueErrors_template)
707 match, rest = self.split_exception_group(eg, (TypeError, SyntaxError))
708 self.assertMatchesTemplate(match, ExceptionGroup, typeErrors_template)
712 match, rest = eg.split(ExceptionGroup)
713 self.assertIs(match, eg)
717 match, rest = eg.split(MyExceptionGroup)
718 self.assertMatchesTemplate(match, ExceptionGroup, [eg_template[0]])
735 match, rest = self.split_exception_group(beg, TypeError)
736 self.assertIsNone(match)
741 match, rest = self.split_exception_group(
744 match, BaseExceptionGroup, [ValueError(1), KeyboardInterrupt(2)])
748 match, rest = self.split_exception_group(beg, ValueError)
750 match, ExceptionGroup, [ValueError(1)])
755 match, rest = self.split_exception_group(beg, KeyboardInterrupt)
757 match, BaseExceptionGroup, [KeyboardInterrupt(2)])
767 match, rest = eg.split(TypeError)
769 self.assertEqual(match.__notes__, orig_notes)
771 self.assertIsNot(eg.__notes__, match.__notes__)
773 self.assertIsNot(match.__notes__, rest.__notes__)
775 match.add_note("match")
778 self.assertEqual(match.__notes__, orig_notes + ["match"])
786 match, rest = eg.split(TypeError)
787 self.assertFalse(hasattr(match, '__notes__'))
814 match, rest = self.split_exception_group(eg, OSError)
815 self.assertIsNone(match)
820 match, rest = self.split_exception_group(eg, (ValueError, TypeError))
822 match, ExceptionGroup, [ValueError(1), [TypeError(2)]])
826 match, rest = self.split_exception_group(eg, ValueError)
827 self.assertMatchesTemplate(match, ExceptionGroup, [ValueError(1)])
831 match, rest = self.split_exception_group(eg, TypeError)
832 self.assertMatchesTemplate(match, ExceptionGroup, [[TypeError(2)]])
853 match, rest = self.split_exception_group(eg, OSError)
854 self.assertIsNone(match)
859 match, rest = self.split_exception_group(
862 match, BaseExceptionGroup, [ValueError(1), KeyboardInterrupt(2)])
866 match, rest = self.split_exception_group(eg, ValueError)
867 self.assertMatchesTemplate(match, ExceptionGroup, [ValueError(1)])
872 match, rest = self.split_exception_group(eg, KeyboardInterrupt)
874 match, BaseExceptionGroup, [KeyboardInterrupt(2)])
904 match, rest = self.split_exception_group(eg, OSError)
905 self.assertIsNone(match)
911 match, rest = self.split_exception_group(eg, (ValueError, TypeError))
912 self.assertMatchesTemplate(match, EG, [ValueError(1), [TypeError(2)]])
913 self.assertEqual(match.code, 42)
914 self.assertEqual(match.exceptions[1].code, 101)
918 match, rest = self.split_exception_group(eg, ValueError)
919 self.assertMatchesTemplate(match, EG, [ValueError(1)])
920 self.assertEqual(match.code, 42)
926 match, rest = self.split_exception_group(eg, TypeError)
927 self.assertMatchesTemplate(match, EG, [[TypeError(2)]])
928 self.assertEqual(match.code, 42)
929 self.assertEqual(match.exceptions[0].code, 101)