diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-12-24 17:09:51 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-12-24 17:09:51 -0500 |
commit | dcb07762bfc91dec3782096ab6dae995e7c6631a (patch) | |
tree | 55ccaaba21d983370c8f7f8743d20ebdb80c99e5 /tests/test_results.py | |
parent | 8672eee93fc8e4cf017a133607a371547b5e7812 (diff) | |
download | python-coveragepy-git-dcb07762bfc91dec3782096ab6dae995e7c6631a.tar.gz |
Move code to where it belongs
Diffstat (limited to 'tests/test_results.py')
-rw-r--r-- | tests/test_results.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_results.py b/tests/test_results.py index ec6301db..8acbcaec 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -6,7 +6,7 @@ import pytest from coverage.misc import CoverageException -from coverage.results import Numbers, should_fail_under +from coverage.results import format_lines, Numbers, should_fail_under from tests.coveragetest import CoverageTest @@ -111,3 +111,16 @@ def test_should_fail_under(total, fail_under, precision, result): def test_should_fail_under_invalid_value(): with pytest.raises(CoverageException, match=r"fail_under=101"): should_fail_under(100.0, 101, 0) + + +@pytest.mark.parametrize("statements, lines, 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], "1-2, 5-11, 13-14, 99"), + ([1,2,3,4,98,99,100,101,102,103,104], [1,2,99,102,103,104], "1-2, 99, 102-104"), + ([17], [17], "17"), + ([90,91,92,93,94,95], [90,91,92,93,94,95], "90-95"), + ([1, 2, 3, 4, 5], [], ""), + ([1, 2, 3, 4, 5], [4], "4"), +]) +def test_format_lines(statements, lines, result): + assert format_lines(statements, lines) == result |