Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def branch_coverage(self):
# type: () -> Tuple[int, int, Optional[float]]
total = 0
cover = 0
for line in self.lines.values():
b_total, b_cover, _ = line.branch_coverage()
total += b_total
cover += b_cover
percent = calculate_coverage(cover, total, nan_value=None)
return total, cover, percent
def branch_coverage(self):
# type: () -> Tuple[int, int, Optional[float]]
total = len(self.branches)
cover = 0
for branch in self.branches.values():
if branch.is_covered:
cover += 1
percent = calculate_coverage(cover, total, nan_value=None)
return total, cover, percent
total, cover, percent = coverage.line_coverage()
uncovered_lines = coverage.uncovered_lines_str()
percent = '--' if percent is None else str(int(percent))
return (total, cover,
filename + str(total).rjust(8) + str(cover).rjust(8)
+ percent.rjust(6) + "% " + uncovered_lines)
for key in keys:
(t, n, txt) = _summarize_file_coverage(covdata[key])
total_lines += t
total_covered += n
OUTPUT.write(txt + '\n')
# Footer & summary
OUTPUT.write("-" * 78 + '\n')
percent = calculate_coverage(total_covered, total_lines, nan_value=None)
percent = "--" if percent is None else str(int(percent))
OUTPUT.write(
"TOTAL".ljust(40) + str(total_lines).rjust(8)
+ str(total_covered).rjust(8) + str(percent).rjust(6) + "%" + '\n'
)
OUTPUT.write("-" * 78 + '\n')
# Close logfile
if options.output:
OUTPUT.close()
def line_coverage(self):
# type: () -> Tuple[int, int, Optional[float]]
total = 0
cover = 0
for line in self.lines.values():
if line.is_covered or line.is_uncovered:
total += 1
if line.is_covered:
cover += 1
percent = calculate_coverage(cover, total, nan_value=None)
return total, cover, percent