diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-02-09 16:26:39 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-02-09 16:26:39 -0500 |
commit | 700f7083743424ba4370fe6892006a090db08909 (patch) | |
tree | e13eb8a28346586901d32e01f72d0044eacb6596 /tests/test_parser.py | |
parent | 49bd2804c472c7bc3482dffcc47f0189ae72faaf (diff) | |
download | python-coveragepy-git-700f7083743424ba4370fe6892006a090db08909.tar.gz |
Properly handle empty decorated functions in 3.7. #640
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r-- | tests/test_parser.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index e9628ac7..afb87716 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -187,6 +187,23 @@ class PythonParserTest(CoverageTest): self.assertEqual(parser.raw_statements, set([1, 2, 3, 5, 6, 7, 8])) self.assertEqual(parser.statements, set([1, 2, 3])) + def test_empty_decorated_function(self): + parser = self.parse_source("""\ + def decorator(func): + return func + + @decorator + def foo(self): + '''Docstring''' + + @decorator + def bar(self): + pass + """) + self.assertEqual(parser.statements, set([1, 2, 4, 8, 10])) + self.assertEqual(parser.arcs(), set(self.arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8"))) + self.assertEqual(parser.exit_counts(), {1: 1, 2: 1, 4: 1, 8: 1, 10: 1}) + class ParserMissingArcDescriptionTest(CoverageTest): """Tests for PythonParser.missing_arc_description.""" |