class_docstr: Test semantics.
class_docstr_tok: ["Test","semantics","."]
docstr: Test catching an exception thrown into a
  subgenerator and returning a value
docstr_tok: ["Test","catching","an","exception","thrown","into","a","subgenerator","and","returning","a","value"]
code: def test_catching_exception_from_subgen_and_returning(self):
      """
      Test catching an exception thrown into a
      subgenerator and returning a value
      """
  
      def inner():
          try:
              yield 1
          except ValueError:
              trace.append("inner caught ValueError")
          return value
  
      def outer():
          v = yield from inner()
          trace.append("inner returned %r to outer" % (v,))
          yield v
  
      for value in 2, (2,), StopIteration(2):
          trace = []
          g = outer()
          trace.append(next(g))
          trace.append(repr(g.throw(ValueError)))
          self.assertEqual(
              trace,
              [
                  1,
                  "inner caught ValueError",
                  "inner returned %r to outer" % (value,),
                  repr(value),
              ],
          )
  
imports: import unittest
  import inspect
  from test.support import captured_stderr, disable_gc, gc_collect
  from test import support
label_desc: Use image node_id 24 for calling the TestPEP380Operation obj's underlying member method code with example usage: obj.test_catching_exception_from_subgen_and_returning() and returns: value