summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-12-24 16:56:26 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-12-24 16:56:26 -0500
commit601204cb27420d35446e9ad07eb25944d120849b (patch)
tree520ae2adc69a84d21b45aabf3766f1c09a364a06
parent4bc7d3fc0a5ab9d778bd08a276aee7315ca70919 (diff)
downloadpython-coveragepy-601204cb27420d35446e9ad07eb25944d120849b.tar.gz
2.6 and 2.7 are not different wrt constants in while loops
-rw-r--r--coverage/parser.py3
-rw-r--r--tests/test_arcs.py16
2 files changed, 6 insertions, 13 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index e027b41..540ad09 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -646,8 +646,7 @@ class AstArcAnalyzer(object):
if node_name in ["NameConstant", "Num"]:
return "Num"
elif node_name == "Name":
- if ((env.PY3 or env.PYVERSION >= (2, 7)) and
- node.id in ["True", "False", "None"]):
+ if node.id in ["True", "False", "None"]:
return "Name"
return None
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 22323bc..d9b77dc 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -253,13 +253,11 @@ class LoopArcTest(CoverageTest):
arcz=".1 12 23 34 45 36 63 57 7.",
)
# With "while True", 2.x thinks it's computation,
- # 2.7+ and 3.x thinks it's constant.
+ # 3.x thinks it's constant.
if env.PY3:
arcz = ".1 12 23 34 45 36 63 57 7."
- elif env.PYVERSION >= (2, 7):
- arcz = ".1 12 23 34 45 36 62 57 7."
else:
- arcz = ".1 12 23 27 34 45 36 62 57 7."
+ arcz = ".1 12 23 34 45 36 62 57 7."
self.check_coverage("""\
a, i = 1, 0
while True:
@@ -272,10 +270,8 @@ class LoopArcTest(CoverageTest):
arcz=arcz,
)
- def test_zero_coverage_and_regexps(self):
+ def test_zero_coverage_while_loop(self):
# https://bitbucket.org/ned/coveragepy/issue/502
- if env.PYVERSION < (2, 7):
- self.skipTest("No node.id before 2.7")
self.make_file("main.py", "print('done')")
self.make_file("zero.py", """\
def method(self):
@@ -291,11 +287,9 @@ class LoopArcTest(CoverageTest):
def test_bug_496_continue_in_constant_while(self):
# https://bitbucket.org/ned/coveragepy/issue/496
if env.PY3:
- arcz = ".1 12 23 34 45 53 46 6."
- elif env.PYVERSION >= (2, 7):
- arcz = ".1 12 23 34 45 52 46 6."
+ arcz = ".1 12 23 34 45 53 46 6."
else:
- arcz = ".1 12 2-1 23 34 45 52 46 6."
+ arcz = ".1 12 23 34 45 52 46 6."
self.check_coverage("""\
up = iter('ta')
while True: