diff options
-rw-r--r-- | tests/test_arcs.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 2b7dafd4..a4462ea1 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -646,6 +646,27 @@ class YieldTest(CoverageTest): arcz_missing=".3 3-3", arcz_unpredicted="") + def test_coroutines(self): + self.check_coverage("""\ + def double_inputs(): + while [1]: # avoid compiler differences + x = yield + x *= 2 + yield x + + gen = double_inputs() + next(gen) + print(gen.send(10)) + next(gen) + print(gen.send(6)) + """, + arcz= + ".1 17 78 89 9A AB B. " + ".2 23 34 45 52 2.", + arcz_missing="2.", + arcz_unpredicted="") + self.assertEqual(self.stdout(), "20\n12\n") + class MiscArcTest(CoverageTest): """Miscellaneous arc-measuring tests.""" |