summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
Diffstat (limited to 'coverage')
-rw-r--r--coverage/html.py5
-rw-r--r--coverage/plugin.py15
-rw-r--r--coverage/python.py6
3 files changed, 23 insertions, 3 deletions
diff --git a/coverage/html.py b/coverage/html.py
index ce394530..19898cbe 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -218,16 +218,15 @@ class HtmlReporter(Reporter):
for b in missing_branch_arcs[lineno]:
if b < 0:
shorts.append("exit")
- longs.append("the function exit")
else:
shorts.append(b)
- longs.append("line %d" % b)
+ longs.append(fr.arc_destination_description(b))
# 202F is NARROW NO-BREAK SPACE.
# 219B is RIGHTWARDS ARROW WITH STROKE.
short_fmt = "%s&#x202F;&#x219B;&#x202F;%s"
annotate_html = ",&nbsp;&nbsp; ".join(short_fmt % (lineno, d) for d in shorts)
- annotate_long = "Line %d was executed, but never jumped to " % lineno
+ annotate_long = "Line %d was executed, but didn't " % lineno
if len(longs) == 1:
annotate_long += longs[0]
elif len(longs) == 2:
diff --git a/coverage/plugin.py b/coverage/plugin.py
index f870c254..095b268c 100644
--- a/coverage/plugin.py
+++ b/coverage/plugin.py
@@ -329,6 +329,21 @@ class FileReporter(object):
"""
return {}
+ def arc_destination_description(self, lineno):
+ """Provide an English phrase describing an arc destination.
+
+ For an arc like (123, 456), it should read well to use the phrase like
+ this::
+
+ "Line {0} didn't {1}".format(123, arc_destination_description(456))
+
+ TODO: say more.
+
+ By default, this simply returns the string "jump to {lineno}".
+
+ """
+ return "jump to line {lineno}".format(lineno=lineno)
+
def source_token_lines(self):
"""Generate a series of tokenized lines, one for each line in `source`.
diff --git a/coverage/python.py b/coverage/python.py
index 07d23472..f50d4d94 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -165,6 +165,12 @@ class PythonFileReporter(FileReporter):
def exit_counts(self):
return self.parser.exit_counts()
+ def arc_destination_description(self, lineno):
+ if lineno < 0:
+ return "jump to the function exit"
+ else:
+ return "jump to line {lineno}".format(lineno=lineno)
+
@contract(returns='unicode')
def source(self):
if self._source is None: