def METHOD_NAME(self, coroutine_steps: int):
    try:
        for i in range(coroutine_steps):
            sent_i = yield i
            self.assertEqual(i, sent_i)
            self.events.append(("sent", sent_i))
        return "finished loop"  # noqa: B901
    except GeneratorExit:
        raise GeneratorExitWithResult("coroutine closed")