def METHOD_NAME(self):
    # Attempting to clear an executing generator frame is forbidden.
    endly = False
    def g():
        nonlocal endly
        try:
            1/0
        except ZeroDivisionError as e:
            f = e.__traceback__.tb_frame
            with self.assertRaises(RuntimeError):
                f.clear()
            with self.assertRaises(RuntimeError):
                f.f_back.clear()
            yield f
        finally:
            endly = True
    gen = g()
    f = next(gen)
    self.assertFalse(endly)
    # Clearing the frame closes the generator
    f.clear()
    self.assertTrue(endly)