MCPcopy Index your code
hub / github.com/RustPython/RustPython / store_raise_exc_generator

Method store_raise_exc_generator

Lib/test/test_generators.py:419–434  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

417
418 def test_except_throw(self):
419 def store_raise_exc_generator():
420 try:
421 self.assertIsNone(sys.exception())
422 yield
423 except Exception as exc:
424 # exception raised by gen.throw(exc)
425 self.assertIsInstance(sys.exception(), ValueError)
426 self.assertIsNone(exc.__context__)
427 yield
428
429 # ensure that the exception is not lost
430 self.assertIsInstance(sys.exception(), ValueError)
431 yield
432
433 # we should be able to raise back the ValueError
434 raise
435
436 make = store_raise_exc_generator()
437 next(make)

Callers

nothing calls this directly

Calls 3

assertIsNoneMethod · 0.80
assertIsInstanceMethod · 0.80
exceptionMethod · 0.45

Tested by

no test coverage detected