From 0e9683111708fc0935bc576db6e27c39f127915c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 24 Oct 2009 14:36:24 -0400 Subject: Cleanup, and write doc strings. --- coverage/control.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 9638c2d1..d406e80c 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -363,28 +363,37 @@ class Analysis(object): # Identify missing statements. self.missing = [] self.executed = self.coverage.data.executed_lines(self.filename) - exec1 = self.parser._map_to_first_lines(self.executed) + exec1 = self.parser.first_lines(self.executed) self.missing = sorted(set(self.statements) - set(exec1)) def missing_formatted(self): + """The missing line numbers, formatted nicely. + + Returns a string like "1-2, 5-11, 13-14". + + """ return format_lines(self.statements, self.missing) def arc_possibilities(self): - return self.parser.arc_info() + """Returns a sorted list of the arcs in the code.""" + return self.parser.arcs() def arcs_executed(self): + """Returns a sorted list of the arcs actually executed in the code.""" executed = self.coverage.data.executed_arcs(self.filename) - m2fl = self.parser._map_to_first_line + m2fl = self.parser.first_line executed = [(m2fl(l1), m2fl(l2)) for (l1,l2) in executed] - return executed + return sorted(executed) def arcs_missing(self): + """Returns a sorted list of the arcs in the code not executed.""" possible = self.arc_possibilities() executed = self.arcs_executed() missing = [p for p in possible if p not in executed] return sorted(missing) def arcs_unpredicted(self): + """Returns a sorted list of the executed arcs missing from the code.""" possible = self.arc_possibilities() executed = self.arcs_executed() # Exclude arcs here which connect a line to itself. They can occur -- cgit v1.2.1