Skip to content

Commit 54887eb

Browse files
committed
test: restore assertions dropped accidentally
These were lost in commit cf1efa8 commit cf1efa8 Author: stepeos <[email protected]> Date: Sat Nov 5 17:29:04 2022 +0100 feat: report terminal output in Markdown Table format #1418 (#1479)
1 parent 77a812b commit 54887eb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_report.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,18 @@ def branch(x, y):
323323
cov = coverage.Coverage(branch=True)
324324
self.start_import_stop(cov, "mybranch")
325325
assert self.stdout() == 'x\ny\n'
326+
report = self.get_report(cov, show_missing=True)
327+
328+
# Name Stmts Miss Branch BrPart Cover Missing
329+
# ----------------------------------------------------------
330+
# mybranch.py 6 0 4 2 80% 2->4, 4->exit
331+
# ----------------------------------------------------------
332+
# TOTAL 6 0 4 2 80%
333+
334+
assert self.line_count(report) == 5
335+
squeezed = self.squeezed_lines(report)
336+
assert squeezed[2] == "mybranch.py 6 0 4 2 80% 2->4, 4->exit"
337+
assert squeezed[4] == "TOTAL 6 0 4 2 80%"
326338

327339
def test_report_show_missing_branches_and_lines(self) -> None:
328340
self.make_file("main.py", """\
@@ -343,6 +355,17 @@ def branch(x, y, z):
343355
cov = coverage.Coverage(branch=True)
344356
self.start_import_stop(cov, "main")
345357
assert self.stdout() == 'x\ny\n'
358+
report_lines = self.get_report(cov, squeeze=False, show_missing=True).splitlines()
359+
360+
expected = [
361+
'Name Stmts Miss Branch BrPart Cover Missing',
362+
'---------------------------------------------------------',
363+
'main.py 1 0 0 0 100%',
364+
'mybranch.py 10 2 8 3 61% 2->4, 4->6, 7-8',
365+
'---------------------------------------------------------',
366+
'TOTAL 11 2 8 3 63%',
367+
]
368+
assert expected == report_lines
346369

347370
def test_report_skip_covered_no_branches(self) -> None:
348371
self.make_file("main.py", """\

0 commit comments

Comments
 (0)