summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/parser.py2
-rw-r--r--tests/test_arcs.py39
2 files changed, 39 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index 1c19f69e..61a69e81 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -770,8 +770,6 @@ class AstArcAnalyzer(object):
return None
# In the fullness of time, these might be good tests to write:
- # while EXPR:
- # while False:
# listcomps hidden deep in other expressions
# listcomps hidden in lists: x = [[i for i in range(10)]]
# nested function definitions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index d3430af2..a952ee3d 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -283,6 +283,45 @@ class LoopArcTest(CoverageTest):
arcz=arcz,
)
+ def test_todo1(self):
+ self.check_coverage("""\
+ a = 1
+ while True:
+ a = 3
+ break
+ assert a == 3
+ """,
+ arcz = ".1 12 23 34 45 5.",
+ arcz_missing = "",
+ )
+ def test_todo3(self):
+ self.check_coverage("""\
+ a = 1
+ while False:
+ a = 3
+ break
+ assert a == 1
+ """,
+ arcz = ".1 12 23 34 45 5.",
+ arcz_missing = "34 45",
+ )
+ def test_todo2(self):
+ self.check_coverage("""\
+ a = 1
+ while True:
+ a = 3
+ break
+ else:
+ a = 6
+ assert a == 3
+ """,
+ arcz = ".1 12 23 34 47 7. 67",
+ arcz_missing = "67",
+ )
+ assert "while True with else" == "done"
+ assert "while False with else" == "done"
+ assert "while if continue else break" == "done"
+
def test_zero_coverage_while_loop(self):
# https://bitbucket.org/ned/coveragepy/issue/502
self.make_file("main.py", "print('done')")