diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-19 21:14:55 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-19 21:14:55 -0500 |
commit | 3e901194d5fa45ede0bf23f20a407f242b6f56d8 (patch) | |
tree | cf53e7c7a22f0730414a865d6e50fec6e8d4f780 /coverage/collector.py | |
parent | ba65cc0d4f6e1d6757b2cb3fd43e8f488b68bf7d (diff) | |
download | python-coveragepy-3e901194d5fa45ede0bf23f20a407f242b6f56d8.tar.gz |
Don't report negative line numbers through get_line_data
Diffstat (limited to 'coverage/collector.py')
-rw-r--r-- | coverage/collector.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index c156090..948cbbb 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 |