summaryrefslogtreecommitdiff
path: root/coverage/parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-02-25 08:38:20 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-02-25 08:38:20 -0500
commit2c60d618ccc611e0a901fd5825a4b5f8f8cc9042 (patch)
tree8209863512194d91279b1dec58aefb7eb26adf8a /coverage/parser.py
parentba3b00aea7ece98694766976095a46bcffc2e403 (diff)
downloadpython-coveragepy-git-2c60d618ccc611e0a901fd5825a4b5f8f8cc9042.tar.gz
Better branch-missed messages for lambdas.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r--coverage/parser.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index 0f597744..f34a26fb 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -317,6 +317,9 @@ class PythonParser(object):
if emsg is None:
if end < 0:
+ # Hmm, maybe we have a one-line callable, let's check.
+ if (-end, end) in self._missing_arc_fragments:
+ return self.missing_arc_description(-end, end)
emsg = "didn't jump to the function exit"
else:
emsg = "didn't jump to line {lineno}"
@@ -907,7 +910,7 @@ class AstArcAnalyzer(object):
if node.body:
exits = self.add_body_arcs(node.body, from_start=ArcStart(-1))
for xit in exits:
- self.add_arc(xit.lineno, -start, xit.cause, 'exit the module')
+ self.add_arc(xit.lineno, -start, xit.cause, "didn't exit the module")
else:
# Empty module.
self.add_arc(-1, start)
@@ -929,7 +932,7 @@ class AstArcAnalyzer(object):
for xit in exits:
self.add_arc(
xit.lineno, -start, xit.cause,
- "exit the body of class '{0}'".format(node.name),
+ "didn't exit the body of class '{0}'".format(node.name),
)
def _make_oneline_code_method(noun): # pylint: disable=no-self-argument