From 8c2cea536675e503e2eb78fd94e04f9635129e26 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 26 May 2014 13:42:02 -0400 Subject: Fix formatting when no missing lines; improve tests --- coverage/results.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'coverage/results.py') diff --git a/coverage/results.py b/coverage/results.py index ce9e0fa..94785ca 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -83,6 +83,22 @@ class Analysis(object): ) return sorted(missing) + def arcs_missing_formatted(self): + """ The missing branch arcs, formatted. + + Returns a string like "1->2, 1->3, 16->20" + + """ + arcs = self.missing_branch_arcs() + line_exits = sorted(arcs.iteritems(), key=lambda (x, _): x) + pairs = [] + for line, exits in line_exits: + exits = sorted(exits) + for exit in exits: + pair = '%d->%d' % (line, exit) + pairs.append(pair) + return ', '.join(pairs) + def arcs_unpredicted(self): """Returns a sorted list of the executed arcs missing from the code.""" possible = self.arc_possibilities() -- cgit v1.2.1