summaryrefslogtreecommitdiff
path: root/tests/test_arcs.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-09-12 16:33:13 -0400
committerNed Batchelder <ned@nedbatchelder.com>2020-09-12 16:33:13 -0400
commit1c13cb9cce73bf1e47977be89ef3b086e36ef3c8 (patch)
treee9ee8c4e244cc651575d066d5d3326dbd77539b2 /tests/test_arcs.py
parentc3159081ae67864f75aacc1b86310fe9d8d614cb (diff)
downloadpython-coveragepy-git-nedbat/test-2506.tar.gz
Adapt to https://github.com/python/cpython/pull/22027nedbat/test-2506
Diffstat (limited to 'tests/test_arcs.py')
-rw-r--r--tests/test_arcs.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index c16f3fa7..daeb7dff 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -248,7 +248,9 @@ class LoopArcTest(CoverageTest):
def test_while_true(self):
# With "while 1", the loop knows it's constant.
- if env.PYBEHAVIOR.nix_while_true:
+ if env.NOOPT:
+ arcz = ".1 12 23 34 45 36 62 57 7."
+ elif env.PYBEHAVIOR.nix_while_true:
arcz = ".1 13 34 45 36 63 57 7."
else:
arcz = ".1 12 23 34 45 36 63 57 7."
@@ -265,7 +267,9 @@ class LoopArcTest(CoverageTest):
)
# With "while True", 2.x thinks it's computation,
# 3.x thinks it's constant.
- if env.PYBEHAVIOR.nix_while_true:
+ if env.NOOPT:
+ arcz = ".1 12 23 34 45 36 62 57 7."
+ elif env.PYBEHAVIOR.nix_while_true:
arcz = ".1 13 34 45 36 63 57 7."
elif env.PY3:
arcz = ".1 12 23 34 45 36 63 57 7."
@@ -305,7 +309,9 @@ class LoopArcTest(CoverageTest):
def test_bug_496_continue_in_constant_while(self):
# https://github.com/nedbat/coveragepy/issues/496
# A continue in a while-true needs to jump to the right place.
- if env.PYBEHAVIOR.nix_while_true:
+ if env.NOOPT:
+ arcz = ".1 12 23 34 45 52 46 67 7."
+ elif env.PYBEHAVIOR.nix_while_true:
arcz = ".1 13 34 45 53 46 67 7."
elif env.PY3:
arcz = ".1 12 23 34 45 53 46 67 7."
@@ -1086,6 +1092,10 @@ class OptimizedIfTest(CoverageTest):
"""Tests of if statements being optimized away."""
def test_optimized_away_if_0(self):
+ if env.NOOPT:
+ lines = [1, 2, 3, 4, 5, 6, 8, 9]
+ else:
+ lines = [1, 2, 3, 8, 9]
self.check_coverage("""\
a = 1
if len([2]):
@@ -1097,7 +1107,7 @@ class OptimizedIfTest(CoverageTest):
e = 8
f = 9
""",
- lines=[1, 2, 3, 8, 9],
+ lines=lines,
arcz=".1 12 23 28 38 89 9.",
arcz_missing="28",
)