From ce17b1a6811e4cacbb7de5c876003347b0a91e65 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 31 Jan 2016 18:39:49 -0500 Subject: Yield statements that are not resumed shouldn't be marked as missing. #440 --- tests/test_arcs.py | 16 ++++++++++++++++ tests/test_data.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'tests') 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.""" diff --git a/tests/test_data.py b/tests/test_data.py index b3882726..52702e97 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -66,7 +66,7 @@ ARCS_4 = { (1000, -1): None, }, } -SUMMARY_3_4 = {'x.py': 5, 'y.py': 2, 'z.py': 1} +SUMMARY_3_4 = {'x.py': 4, 'y.py': 2, 'z.py': 1} MEASURED_FILES_3_4 = ['x.py', 'y.py', 'z.py'] -- cgit v1.2.1