summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_coverage.py10
-rw-r--r--tests/test_results.py24
-rw-r--r--tests/test_summary.py2
3 files changed, 30 insertions, 6 deletions
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 947c5f1e..1b23f408 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -677,7 +677,7 @@ class CompoundStatementTest(CoverageTest):
z = 7
assert x == 3
""",
- [1,2,3,4,5,7,8], "4-7", report="7 3 4 1 45% 4-7, 2->4",
+ [1,2,3,4,5,7,8], "4-7", report="7 3 4 1 45% 2->4, 4-7",
)
self.check_coverage("""\
a = 1; b = 2; c = 3;
@@ -689,7 +689,7 @@ class CompoundStatementTest(CoverageTest):
z = 7
assert y == 5
""",
- [1,2,3,4,5,7,8], "3, 7", report="7 2 4 2 64% 3, 7, 2->3, 4->7",
+ [1,2,3,4,5,7,8], "3, 7", report="7 2 4 2 64% 2->3, 3, 4->7, 7",
)
self.check_coverage("""\
a = 1; b = 2; c = 3;
@@ -701,7 +701,7 @@ class CompoundStatementTest(CoverageTest):
z = 7
assert z == 7
""",
- [1,2,3,4,5,7,8], "3, 5", report="7 2 4 2 64% 3, 5, 2->3, 4->5",
+ [1,2,3,4,5,7,8], "3, 5", report="7 2 4 2 64% 2->3, 3, 4->5, 5",
)
def test_elif_no_else(self):
@@ -713,7 +713,7 @@ class CompoundStatementTest(CoverageTest):
y = 5
assert x == 3
""",
- [1,2,3,4,5,6], "4-5", report="6 2 4 1 50% 4-5, 2->4",
+ [1,2,3,4,5,6], "4-5", report="6 2 4 1 50% 2->4, 4-5",
)
self.check_coverage("""\
a = 1; b = 2; c = 3;
@@ -723,7 +723,7 @@ class CompoundStatementTest(CoverageTest):
y = 5
assert y == 5
""",
- [1,2,3,4,5,6], "3", report="6 1 4 2 70% 3, 2->3, 4->6",
+ [1,2,3,4,5,6], "3", report="6 1 4 2 70% 2->3, 3, 4->6",
)
def test_elif_bizarre(self):
diff --git a/tests/test_results.py b/tests/test_results.py
index 8acbcaec..41494e66 100644
--- a/tests/test_results.py
+++ b/tests/test_results.py
@@ -124,3 +124,27 @@ def test_should_fail_under_invalid_value():
])
def test_format_lines(statements, lines, result):
assert format_lines(statements, lines) == result
+
+
+@pytest.mark.parametrize("statements, lines, arcs, result", [
+ (
+ set([1,2,3,4,5,10,11,12,13,14]),
+ set([1,2,5,10,11,13,14]),
+ (),
+ "1-2, 5-11, 13-14"
+ ),
+ (
+ [1,2,3,4,5,10,11,12,13,14,98,99],
+ [1,2,5,10,11,13,14,99],
+ [(3, [4]), (98, [100, -1])],
+ "1-2, 3->4, 5-11, 13-14, 98->100, 98->exit, 99"
+ ),
+ (
+ [1,2,3,4,98,99,100,101,102,103,104],
+ [1,2,99,102,103,104],
+ [(3, [4]), (104, [-1])],
+ "1-2, 3->4, 99, 102-104"
+ ),
+])
+def test_format_lines_with_arcs(statements, lines, arcs, result):
+ assert format_lines(statements, lines, arcs) == result
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 60a96e64..8dd56e64 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -263,7 +263,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
'Name Stmts Miss Branch BrPart Cover Missing',
'---------------------------------------------------------',
'main.py 1 0 0 0 100%',
- 'mybranch.py 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7',
+ 'mybranch.py 10 2 8 3 61% 2->4, 4->6, 6->7, 7-8',
'---------------------------------------------------------',
'TOTAL 11 2 8 3 63%',
]