class_docstr: Test semantics.
class_docstr_tok: ["Test","semantics","."]
docstr: Test delegating 'throw' to non-generator
docstr_tok: ["Test","delegating","'throw","'","to","non-generator"]
code: def test_delegating_throw_to_non_generator(self):
      """
      Test delegating 'throw' to non-generator
      """
      trace = []
  
      def g():
          try:
              trace.append("Starting g")
              yield from range(10)
          finally:
              trace.append("Finishing g")
  
      try:
          gi = g()
          for i in range(5):
              x = next(gi)
              trace.append("Yielded %s" % (x,))
          e = ValueError("tomato ejected")
          gi.throw(e)
      except ValueError as e:
          self.assertEqual(e.args[0], "tomato ejected")
      else:
          self.fail("subgenerator failed to raise ValueError")
      self.assertEqual(
          trace,
          [
              "Starting g",
              "Yielded 0",
              "Yielded 1",
              "Yielded 2",
              "Yielded 3",
              "Yielded 4",
              "Finishing g",
          ],
      )
  
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 16 for calling the TestPEP380Operation obj's underlying member method code with example usage: obj.test_delegating_throw_to_non_generator() without return types