eric7/DebugClients/Python/coverage/results.py

branch
eric7
changeset 8527
2bd1325d727e
parent 8312
800c432b34c8
child 8775
0802ae193343
equal deleted inserted replaced
8526:587202572b10 8527:2bd1325d727e
144 144
145 missing_arcs = self.missing_branch_arcs() 145 missing_arcs = self.missing_branch_arcs()
146 stats = {} 146 stats = {}
147 for lnum in self._branch_lines(): 147 for lnum in self._branch_lines():
148 exits = self.exit_counts[lnum] 148 exits = self.exit_counts[lnum]
149 try: 149 missing = len(missing_arcs[lnum])
150 missing = len(missing_arcs[lnum])
151 except KeyError:
152 missing = 0
153 stats[lnum] = (exits, exits - missing) 150 stats[lnum] = (exits, exits - missing)
154 return stats 151 return stats
155 152
156 153
157 class Numbers(SimpleReprMixin): 154 class Numbers(SimpleReprMixin):
263 260
264 def __radd__(self, other): 261 def __radd__(self, other):
265 # Implementing 0+Numbers allows us to sum() a list of Numbers. 262 # Implementing 0+Numbers allows us to sum() a list of Numbers.
266 if other == 0: 263 if other == 0:
267 return self 264 return self
268 return NotImplemented 265 return NotImplemented # pragma: not covered (we never call it this way)
269 266
270 267
271 def _line_ranges(statements, lines): 268 def _line_ranges(statements, lines):
272 """Produce a list of ranges for `format_lines`.""" 269 """Produce a list of ranges for `format_lines`."""
273 statements = sorted(statements) 270 statements = sorted(statements)
313 line_items = [(pair[0], nice_pair(pair)) for pair in _line_ranges(statements, lines)] 310 line_items = [(pair[0], nice_pair(pair)) for pair in _line_ranges(statements, lines)]
314 if arcs: 311 if arcs:
315 line_exits = sorted(arcs) 312 line_exits = sorted(arcs)
316 for line, exits in line_exits: 313 for line, exits in line_exits:
317 for ex in sorted(exits): 314 for ex in sorted(exits):
318 if line not in lines: 315 if line not in lines and ex not in lines:
319 dest = (ex if ex > 0 else "exit") 316 dest = (ex if ex > 0 else "exit")
320 line_items.append((line, "%d->%s" % (line, dest))) 317 line_items.append((line, "%d->%s" % (line, dest)))
321 318
322 ret = ', '.join(t[-1] for t in sorted(line_items)) 319 ret = ', '.join(t[-1] for t in sorted(line_items))
323 return ret 320 return ret

eric ide

mercurial