Lines Matching defs:exc
275 def assertMatchesTemplate(self, exc, exc_type, template):
278 A template describes the shape of exc. If exc is a
281 expected type and args value of exc. If exc is an
286 self.assertIs(type(exc), exc_type)
288 if isinstance(exc, BaseExceptionGroup):
290 self.assertEqual(len(exc.exceptions), len(template))
291 for e, t in zip(exc.exceptions, template):
295 self.assertEqual(type(exc), type(template))
296 self.assertEqual(exc.args, template.args)
452 def leaf_generator(exc, tbs=None):
455 tbs.append(exc.__traceback__)
456 if isinstance(exc, BaseExceptionGroup):
457 for e in exc.exceptions:
460 # exc is a leaf exception and its traceback
463 yield exc, tbs
573 def leaves(exc):
574 return [] if exc is None else [e for e,_ in leaf_generator(exc)]
722 def exc(ex):
730 "beg", [exc(ValueError(1)), exc(KeyboardInterrupt(2))])