summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-01-05 06:54:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-01-05 06:54:07 -0500
commitf7f56ec9adaa531019a27ef7c634db816f30040a (patch)
tree43d50cdfde9083d9de8e81211bd466a40fa323ff /tests
parent4074315ac65ed79e94bc331a8059859781b5b12b (diff)
downloadpython-coveragepy-git-f7f56ec9adaa531019a27ef7c634db816f30040a.tar.gz
Support while-else
--HG-- branch : ast-branch
Diffstat (limited to 'tests')
-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 fb4b99eb..cab95c8f 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -314,6 +314,22 @@ class LoopArcTest(CoverageTest):
arcz=".1 .2 23 32 34 47 26 67 7. 18 89 9."
)
+ def test_while_else(self):
+ self.check_coverage("""\
+ def whileelse(seq):
+ while seq:
+ n = seq.pop()
+ if n > 4:
+ break
+ else:
+ n = 99
+ return n
+ assert whileelse([1, 2]) == 99
+ assert whileelse([1, 5]) == 5
+ """,
+ arcz=".1 19 9A A. .2 23 34 45 58 42 27 78 8.",
+ )
+
def test_confusing_for_loop_bug_175(self):
if env.PY3:
# Py3 counts the list comp as a separate code object.