summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-06-21 19:26:48 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-06-21 20:16:51 +0200
commita1ac842bf51371a54fad1c13d56abe33ec1b9dcc (patch)
treeb2aae0d2d65d1f39e3b33e55264ad85677d9fb3e /tests
parent6a18c1018c305148fde423e167ff783754b2be75 (diff)
downloadastroid-git-a1ac842bf51371a54fad1c13d56abe33ec1b9dcc.tar.gz
Rename non obvious PY3X constant to PY3X_PLUS
See https://github.com/PyCQA/astroid/pull/1069\#issuecomment-865206120
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest_brain.py8
-rw-r--r--tests/unittest_builder.py6
-rw-r--r--tests/unittest_inference.py12
-rw-r--r--tests/unittest_nodes.py12
-rw-r--r--tests/unittest_protocols.py4
5 files changed, 21 insertions, 21 deletions
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py
index fe75694d..6114e893 100644
--- a/tests/unittest_brain.py
+++ b/tests/unittest_brain.py
@@ -44,7 +44,7 @@ import pytest
import astroid
from astroid import MANAGER, bases, builder, nodes, objects, test_utils, util
-from astroid.const import PY37
+from astroid.const import PY37_PLUS
from astroid.exceptions import AttributeInferenceError, InferenceError
try:
@@ -2730,7 +2730,7 @@ def test_http_client_brain():
assert isinstance(inferred, astroid.Instance)
-@pytest.mark.skipif(not PY37, reason="Needs 3.7+")
+@pytest.mark.skipif(not PY37_PLUS, reason="Needs 3.7+")
def test_http_status_brain():
node = astroid.extract_node(
"""
@@ -2767,7 +2767,7 @@ def test_oserror_model():
assert strerror.value == ""
-@pytest.mark.skipif(not PY37, reason="Dynamic module attributes since Python 3.7")
+@pytest.mark.skipif(not PY37_PLUS, reason="Dynamic module attributes since Python 3.7")
def test_crypt_brain():
module = MANAGER.ast_from_module_name("crypt")
dynamic_attrs = [
@@ -2781,7 +2781,7 @@ def test_crypt_brain():
assert attr in module
-@pytest.mark.skipif(not PY37, reason="Dataclasses were added in 3.7")
+@pytest.mark.skipif(not PY37_PLUS, reason="Dataclasses were added in 3.7")
def test_dataclasses():
code = """
import dataclasses
diff --git a/tests/unittest_builder.py b/tests/unittest_builder.py
index 0879c1a3..18261cfc 100644
--- a/tests/unittest_builder.py
+++ b/tests/unittest_builder.py
@@ -31,7 +31,7 @@ import unittest
import pytest
from astroid import Instance, builder, nodes, test_utils, util
-from astroid.const import PY38
+from astroid.const import PY38_PLUS
from astroid.exceptions import (
AstroidBuildingError,
AstroidSyntaxError,
@@ -70,7 +70,7 @@ class FromToLineNoTest(unittest.TestCase):
if hasattr(sys, "pypy_version_info"):
lineno = 4
else:
- lineno = 5 if not PY38 else 4
+ lineno = 5 if not PY38_PLUS else 4
self.assertEqual(strarg.fromlineno, lineno)
self.assertEqual(strarg.tolineno, lineno)
namearg = callfunc.args[1]
@@ -750,7 +750,7 @@ def test_module_build_dunder_file():
@pytest.mark.skipif(
- PY38,
+ PY38_PLUS,
reason=(
"The builtin ast module does not fail with a specific error "
"for syntax error caused by invalid type comments."
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py
index 72baf22b..55dfc5bb 100644
--- a/tests/unittest_inference.py
+++ b/tests/unittest_inference.py
@@ -49,7 +49,7 @@ from astroid import decorators as decoratorsmod
from astroid import helpers, nodes, objects, test_utils, util
from astroid.bases import BUILTINS, BoundMethod, Instance, UnboundMethod
from astroid.builder import extract_node, parse
-from astroid.const import PY38, PY39
+from astroid.const import PY38_PLUS, PY39_PLUS
from astroid.exceptions import (
AstroidTypeError,
AttributeInferenceError,
@@ -932,7 +932,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertEqual("module.D", should_be_d[0].qname())
@pytest.mark.skipif(
- PY38,
+ PY38_PLUS,
reason="pathlib.Path cannot be inferred on Python 3.8",
)
def test_factory_methods_inside_binary_operation(self):
@@ -2495,7 +2495,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
]
# PEP-584 supports | for dictionary union
- if not PY39:
+ if not PY39_PLUS:
ast_nodes.append(extract_node("{} | {} #@"))
expected.append(msg.format(op="|", lhs="dict", rhs="dict"))
@@ -5882,9 +5882,9 @@ def test_custom_decorators_for_classmethod_and_staticmethods(code, obj, obj_type
assert inferred.type == obj_type
-@pytest.mark.skipif(not PY38, reason="Needs dataclasses available")
+@pytest.mark.skipif(not PY38_PLUS, reason="Needs dataclasses available")
@pytest.mark.skipif(
- PY39,
+ PY39_PLUS,
reason="Exact inference with dataclasses (replace function) in python3.9",
)
def test_dataclasses_subscript_inference_recursion_error():
@@ -5908,7 +5908,7 @@ def test_dataclasses_subscript_inference_recursion_error():
@pytest.mark.skipif(
- not PY39,
+ not PY39_PLUS,
reason="Exact inference with dataclasses (replace function) in python3.9",
)
def test_dataclasses_subscript_inference_recursion_error_39():
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py
index 9cd844aa..6ad6d11c 100644
--- a/tests/unittest_nodes.py
+++ b/tests/unittest_nodes.py
@@ -40,7 +40,7 @@ import astroid
from astroid import bases, builder
from astroid import context as contextmod
from astroid import node_classes, nodes, parse, test_utils, transforms, util
-from astroid.const import PY38, PY310, Context
+from astroid.const import PY38_PLUS, PY310_PLUS, Context
from astroid.exceptions import (
AstroidBuildingError,
AstroidSyntaxError,
@@ -57,7 +57,7 @@ try:
HAS_TYPED_AST = True
except ImportError:
# typed_ast merged in `ast` in Python 3.8
- HAS_TYPED_AST = PY38
+ HAS_TYPED_AST = PY38_PLUS
class AsStringTest(resources.SysPathSetup, unittest.TestCase):
@@ -549,7 +549,7 @@ class ConstNodeTest(unittest.TestCase):
self._test("a")
@pytest.mark.skipif(
- not PY38, reason="kind attribute for ast.Constant was added in 3.8"
+ not PY38_PLUS, reason="kind attribute for ast.Constant was added in 3.8"
)
def test_str_kind(self):
node = builder.extract_node(
@@ -1133,7 +1133,7 @@ def test_type_comments_arguments():
@pytest.mark.skipif(
- not PY38, reason="needs to be able to parse positional only arguments"
+ not PY38_PLUS, reason="needs to be able to parse positional only arguments"
)
def test_type_comments_posonly_arguments():
module = builder.parse(
@@ -1252,7 +1252,7 @@ def test_f_string_correct_line_numbering():
assert node.last_child().last_child().lineno == 5
-@pytest.mark.skipif(not PY38, reason="needs assignment expressions")
+@pytest.mark.skipif(not PY38_PLUS, reason="needs assignment expressions")
def test_assignment_expression():
code = """
if __(a := 1):
@@ -1368,7 +1368,7 @@ def test_is_generator_for_yield_in_aug_assign():
assert bool(node.is_generator())
-@pytest.mark.skipif(not PY310, reason="pattern matching was added in PY310")
+@pytest.mark.skipif(not PY310_PLUS, reason="pattern matching was added in PY310")
class TestPatternMatching:
@staticmethod
def test_match_simple():
diff --git a/tests/unittest_protocols.py b/tests/unittest_protocols.py
index 35e42313..cc6bc1ad 100644
--- a/tests/unittest_protocols.py
+++ b/tests/unittest_protocols.py
@@ -19,7 +19,7 @@ import pytest
import astroid
from astroid import extract_node, nodes, util
-from astroid.const import PY38
+from astroid.const import PY38_PLUS
from astroid.exceptions import InferenceError
from astroid.node_classes import AssignName, Const, Name, Starred
@@ -211,7 +211,7 @@ class ProtocolTests(unittest.TestCase):
parsed.accept(Visitor())
-@pytest.mark.skipif(not PY38, reason="needs assignment expressions")
+@pytest.mark.skipif(not PY38_PLUS, reason="needs assignment expressions")
def test_named_expr_inference():
code = """
if (a := 2) == 2: