summaryrefslogtreecommitdiff
path: root/test/test_arcs.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-12-20 11:03:33 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-12-20 11:03:33 -0500
commit30c191f13fe5d397d1b624b4894f2c6bd841a389 (patch)
tree70fc7cc600eecfd84697c4be10556dcb3ac7263c /test/test_arcs.py
parentd17aeb10e55585a23702737087afc60a35d3123c (diff)
downloadpython-coveragepy-git-30c191f13fe5d397d1b624b4894f2c6bd841a389.tar.gz
Jumps to jumps could make loops look like they go places they really don't, so start new chunks for every absolute jump. Fixes issue #39.
Diffstat (limited to 'test/test_arcs.py')
-rw-r--r--test/test_arcs.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test_arcs.py b/test/test_arcs.py
index cbd7645d..f93e1f55 100644
--- a/test/test_arcs.py
+++ b/test/test_arcs.py
@@ -229,6 +229,33 @@ class LoopArcTest(CoverageTest):
arcz_missing="27" # while loop never exits naturally.
)
+ def test_for_if_else_for(self):
+ self.check_coverage("""\
+ def branches_2(l):
+ if l:
+ for e in l:
+ a = 4
+ else:
+ a = 6
+
+ def branches_3(l):
+ for x in l:
+ if x:
+ for e in l:
+ a = 12
+ else:
+ a = 14
+
+ branches_2([0,1])
+ branches_3([0,1])
+ """,
+ arcz=
+ ".1 18 8G GH H. "
+ ".2 23 34 43 26 3. 6. "
+ ".9 9A 9. AB BC CB B9 AE E9",
+ arcz_missing="26 6."
+ )
+
class ExceptionArcTest(CoverageTest):
"""Arc-measuring tests involving exception handling."""