diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-02-13 14:03:25 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-02-13 14:03:25 -0500 |
commit | 3d4c86d67af468d2413af38fdfb2afa7ddeed0cb (patch) | |
tree | 381a9b74d5290f07d024b551b2ed87264978def3 /tests/test_parser.py | |
parent | 34d63dbfd76dc3a6091ac95225155212e5b1debf (diff) | |
download | python-coveragepy-git-3d4c86d67af468d2413af38fdfb2afa7ddeed0cb.tar.gz |
More work on the better missed-branch messages
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r-- | tests/test_parser.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index cf433009..53a514e0 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -222,6 +222,34 @@ class ParserMissingArcDescriptionTest(CoverageTest): "line 6 didn't jump to line 7, because the loop on line 6 never started" ) + def test_missing_arc_descriptions_for_small_callables(self): + text = textwrap.dedent(u"""\ + callables = [ + lambda: 0, + (x for x in range(10)), + {x:1 for x in range(10)}, + {x for x in range(10)}, + ] + """) + parser = PythonParser(text=text) + parser.parse_source() + self.assertEqual( + parser.missing_arc_description(2, -2), + "line 2 didn't run the lambda on line 2" + ) + self.assertEqual( + parser.missing_arc_description(3, -3), + "line 3 didn't run the generator expression on line 3" + ) + self.assertEqual( + parser.missing_arc_description(4, -4), + "line 4 didn't run the dictionary comprehension on line 4" + ) + self.assertEqual( + parser.missing_arc_description(5, -5), + "line 5 didn't run the set comprehension on line 5" + ) + class ParserFileTest(CoverageTest): """Tests for coverage.py's code parsing from files.""" |