From c42d59368950e072056da5ba1c34aceac3d7f1f3 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 19 Feb 2015 21:14:55 -0500 Subject: Don't report negative line numbers through get_line_data --- coverage/collector.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'coverage') diff --git a/coverage/collector.py b/coverage/collector.py index c1560902..948cbbb0 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -291,10 +291,14 @@ class Collector(object): """ if self.branch: # If we were measuring branches, then we have to re-build the dict - # to show line data. + # to show line data. We'll use the first lines of all the arcs, + # if they are actual lines. We don't need the second lines, because + # the second lines will also be first lines, sometimes to exits. line_data = {} for f, arcs in self.data.items(): - line_data[f] = dict((l1, None) for l1, _ in arcs.keys() if l1) + line_data[f] = dict( + (l1, None) for l1, _ in arcs.keys() if l1 > 0 + ) return line_data else: return self.data -- cgit v1.2.1