summaryrefslogtreecommitdiff
path: root/tests/test_arcs.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-01-31 18:39:49 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-01-31 18:39:49 -0500
commitce17b1a6811e4cacbb7de5c876003347b0a91e65 (patch)
treef509b5575c1826674b19f226ce9812a58d9edf34 /tests/test_arcs.py
parent703f088e67c256b2491ced099b994f277775fe5f (diff)
downloadpython-coveragepy-git-ce17b1a6811e4cacbb7de5c876003347b0a91e65.tar.gz
Yield statements that are not resumed shouldn't be marked as missing. #440
Diffstat (limited to 'tests/test_arcs.py')
-rw-r--r--tests/test_arcs.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 030b719d..60cef938 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -981,6 +981,22 @@ class YieldTest(CoverageTest):
arcz_unpredicted="5.",
)
+ def test_abandoned_yield(self):
+ # https://bitbucket.org/ned/coveragepy/issue/440
+ self.check_coverage("""\
+ def gen():
+ print("yup")
+ yield "yielded"
+ print("nope")
+
+ print(next(gen()))
+ """,
+ lines=[1, 2, 3, 4, 6],
+ missing="4",
+ arcz=".1 16 6. .2 23 34 4.",
+ arcz_missing="34 4.",
+ )
+
class MiscArcTest(CoverageTest):
"""Miscellaneous arc-measuring tests."""