From 3d4c86d67af468d2413af38fdfb2afa7ddeed0cb Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 13 Feb 2016 14:03:25 -0500 Subject: More work on the better missed-branch messages --- tests/test_parser.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') 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.""" -- cgit v1.2.1