summaryrefslogtreecommitdiff
path: root/tests/test_arcs.py
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
commit452f6f60c89119f1de1254ab9c5f4e25ac2f073d (patch)
tree40009e5bfdd1f3f5d8384762985c38c95686bca9 /tests/test_arcs.py
parent688488a7574cf872574c24d699acf2f869b1c786 (diff)
downloadpython-coveragepy-452f6f60c89119f1de1254ab9c5f4e25ac2f073d.tar.gz
Support while-else
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 fb4b99e..cab95c8 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.