summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-12-31 08:02:17 -0500
committerNed Batchelder <ned@nedbatchelder.com>2019-12-31 08:02:17 -0500
commita6912d67648c1acdae73db7c2b772b09fb236c54 (patch)
tree8e2b30bb58f6bfc02243e167be2ebe271633a987 /tests/test_testing.py
parenta9bc9bfd1179a64839d4908fb8f54e7823ee044e (diff)
downloadpython-coveragepy-git-a6912d67648c1acdae73db7c2b772b09fb236c54.tar.gz
Move test helpers to tests.helpers
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index cf3e2014..2fda956b 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -18,6 +18,7 @@ from coverage.misc import StopEverything
import coverage.optional
from tests.coveragetest import CoverageTest, convert_skip_exceptions
+from tests.helpers import arcs_to_arcz_repr, arcz_to_arcs
from tests.helpers import CheckUniqueFilenames, re_lines, re_line
@@ -331,3 +332,30 @@ def test_optional_without():
assert toml1 is toml3 is not None
assert toml2 is None
+
+
+@pytest.mark.parametrize("arcz, arcs", [
+ (".1 12 2.", [(-1, 1), (1, 2), (2, -1)]),
+ ("-11 12 2-5", [(-1, 1), (1, 2), (2, -5)]),
+ ("-QA CB IT Z-A", [(-26, 10), (12, 11), (18, 29), (35, -10)]),
+])
+def test_arcz_to_arcs(arcz, arcs):
+ assert arcz_to_arcs(arcz) == arcs
+
+
+@pytest.mark.parametrize("arcs, arcz_repr", [
+ ([(-1, 1), (1, 2), (2, -1)], "(-1, 1) # .1\n(1, 2) # 12\n(2, -1) # 2.\n"),
+ ([(-1, 1), (1, 2), (2, -5)], "(-1, 1) # .1\n(1, 2) # 12\n(2, -5) # 2-5\n"),
+ ([(-26, 10), (12, 11), (18, 29), (35, -10), (1, 33), (100, 7)],
+ (
+ "(-26, 10) # -QA\n"
+ "(12, 11) # CB\n"
+ "(18, 29) # IT\n"
+ "(35, -10) # Z-A\n"
+ "(1, 33) # 1X\n"
+ "(100, 7) # ?7\n"
+ )
+ ),
+])
+def test_arcs_to_arcz_repr(arcs, arcz_repr):
+ assert arcs_to_arcz_repr(arcs) == arcz_repr