summaryrefslogtreecommitdiff
path: root/tests/test_parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-02-09 16:26:39 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-02-09 16:26:39 -0500
commitcbfefaeed86e276677d4c0aa56c5897eb67dcf10 (patch)
treea0eef2b2ccb62433606209e32d2185b858deb315 /tests/test_parser.py
parent18f721da6bbc651ddd698b6986f7eb439245d62e (diff)
downloadpython-coveragepy-cbfefaeed86e276677d4c0aa56c5897eb67dcf10.tar.gz
Properly handle empty decorated functions in 3.7. #640
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r--tests/test_parser.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py
index e9628ac..afb8771 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."""