diff options
Diffstat (limited to 'coverage/results.py')
-rw-r--r-- | coverage/results.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/coverage/results.py b/coverage/results.py index 0b27971f..7b621c18 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -7,11 +7,11 @@ from coverage.misc import format_lines class Analysis(object): - """The results of analyzing a code unit.""" + """The results of analyzing a FileReporter.""" - def __init__(self, cov, code_unit): + def __init__(self, cov, file_reporters): self.coverage = cov - self.file_reporter = code_unit + self.file_reporter = file_reporters self.filename = self.file_reporter.filename self.statements = self.file_reporter.statements() self.excluded = self.file_reporter.excluded_statements() @@ -101,10 +101,13 @@ class Analysis(object): # Exclude arcs here which connect a line to itself. They can occur # in executed data in some cases. This is where they can cause # trouble, and here is where it's the least burden to remove them. + # Also, generators can somehow cause arcs from "enter" to "exit", so + # make sure we have at least one positive value. unpredicted = ( e for e in executed if e not in possible and e[0] != e[1] + and (e[0] > 0 or e[1] > 0) ) return sorted(unpredicted) |