6
6
7
7
from astroid import extract_node
8
8
from astroid .const import PY312_PLUS
9
- from astroid .nodes import AssignName , ParamSpec , Subscript , TypeAlias , TypeVar , TypeVarTuple
9
+ from astroid .nodes import (
10
+ AssignName ,
11
+ ParamSpec ,
12
+ Subscript ,
13
+ TypeAlias ,
14
+ TypeVar ,
15
+ TypeVarTuple ,
16
+ )
17
+
18
+ if not PY312_PLUS :
19
+ pytest .skip ("Requires Python 3.12 or higher" , allow_module_level = True )
10
20
11
21
12
- @pytest .mark .skipif (not PY312_PLUS , reason = "Requires Python 3.12 or higher" )
13
22
def test_type_alias () -> None :
14
23
node = extract_node ("type Point[T] = list[float, float]" )
15
24
assert isinstance (node , TypeAlias )
@@ -27,7 +36,6 @@ def test_type_alias() -> None:
27
36
assert node .type_params [0 ].inferred ()[0 ] is node .type_params [0 ]
28
37
29
38
30
- @pytest .mark .skipif (not PY312_PLUS , reason = "Requires Python 3.12 or higher" )
31
39
def test_type_param_spec () -> None :
32
40
node = extract_node ("type Alias[**P] = Callable[P, int]" )
33
41
params = node .type_params [0 ]
@@ -38,7 +46,6 @@ def test_type_param_spec() -> None:
38
46
assert node .inferred ()[0 ] is node
39
47
40
48
41
- @pytest .mark .skipif (not PY312_PLUS , reason = "Requires Python 3.12 or higher" )
42
49
def test_type_var_tuple () -> None :
43
50
node = extract_node ("type Alias[*Ts] = tuple[*Ts]" )
44
51
params = node .type_params [0 ]
@@ -49,7 +56,6 @@ def test_type_var_tuple() -> None:
49
56
assert node .inferred ()[0 ] is node
50
57
51
58
52
- @pytest .mark .skipif (not PY312_PLUS , reason = "Requires Python 3.12 or higher" )
53
59
def test_type_param () -> None :
54
60
func_node = extract_node ("def func[T]() -> T: ..." )
55
61
assert isinstance (func_node .type_params [0 ], TypeVar )
0 commit comments