diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-02-08 09:54:24 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-02-08 09:54:24 -0500 |
commit | cac60611433490b85e337be3c53299a9406fd098 (patch) | |
tree | ee544da31aaa8eca69014a86c82deb950a7ffca4 /tests/test_parser.py | |
parent | 6cda7f1fda3e087b1128b40d73fb4da8486b4b05 (diff) | |
download | python-coveragepy-git-cac60611433490b85e337be3c53299a9406fd098.tar.gz |
missing_arc_description is better than arc_destination_description. One test broken.
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r-- | tests/test_parser.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index 470ea156..48b70ef3 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -186,6 +186,38 @@ class PythonParserTest(CoverageTest): self.assertEqual(parser.statements, set([1, 2, 3])) +class ParserMissingArcDescriptionTest(CoverageTest): + """Tests for PythonParser.missing_arc_description.""" + + run_in_temp_dir = False + + def test_missing_arc_description(self): + text = textwrap.dedent("""\ + if x: + print(2) + print(3) + + def func5(): + for x in range(6): + if x == 3: + break + """) + parser = PythonParser(text=text) + parser.parse_source() + self.assertEqual( + parser.missing_arc_description(1, 2), + "line 1 didn't jump to line 2, because the condition on line 1 was never true" + ) + self.assertEqual( + parser.missing_arc_description(1, 3), + "line 1 didn't jump to line 3, because the condition on line 1 was never false" + ) + self.assertEqual( + parser.missing_arc_description(6, -5), + "line 6 didn't return from function 'func5', because the loop on line 6 didn't complete" + ) + + class ParserFileTest(CoverageTest): """Tests for coverage.py's code parsing from files.""" |