Skip to content

Commit e7ad24c

Browse files
authored
Remove tests with invalid syntax (Python 3.14) (#2093)
1 parent 663d608 commit e7ad24c

File tree

7 files changed

+115
-120
lines changed

7 files changed

+115
-120
lines changed

conformance/results/mypy/qualifiers_annotated.toml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@ Does not reject type[T] compatibility for type alias defined with Annotated.
77
Does not reject call of type alias defined with Annotated.
88
"""
99
output = """
10-
qualifiers_annotated.py:43: error: Bracketed expression "[...]" is not valid as a type [valid-type]
11-
qualifiers_annotated.py:44: error: Syntax error in type annotation [syntax]
12-
qualifiers_annotated.py:44: note: Suggestion: Is there a spurious trailing comma?
13-
qualifiers_annotated.py:45: error: Invalid type comment or annotation [valid-type]
14-
qualifiers_annotated.py:46: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
15-
qualifiers_annotated.py:46: error: Name "b" is not defined [name-defined]
16-
qualifiers_annotated.py:47: error: Invalid type comment or annotation [valid-type]
10+
qualifiers_annotated.py:38: error: Bracketed expression "[...]" is not valid as a type [valid-type]
11+
qualifiers_annotated.py:39: error: Syntax error in type annotation [syntax]
12+
qualifiers_annotated.py:39: note: Suggestion: Is there a spurious trailing comma?
13+
qualifiers_annotated.py:40: error: Invalid type comment or annotation [valid-type]
14+
qualifiers_annotated.py:41: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
15+
qualifiers_annotated.py:41: error: Name "b" is not defined [name-defined]
16+
qualifiers_annotated.py:42: error: Invalid type comment or annotation [valid-type]
17+
qualifiers_annotated.py:43: error: Invalid type comment or annotation [valid-type]
18+
qualifiers_annotated.py:44: error: Invalid type comment or annotation [valid-type]
19+
qualifiers_annotated.py:45: error: Name "var1" is not defined [name-defined]
20+
qualifiers_annotated.py:46: error: Invalid type: try using Literal[True] instead? [valid-type]
21+
qualifiers_annotated.py:47: error: Invalid type: try using Literal[1] instead? [valid-type]
1722
qualifiers_annotated.py:48: error: Invalid type comment or annotation [valid-type]
1823
qualifiers_annotated.py:49: error: Invalid type comment or annotation [valid-type]
19-
qualifiers_annotated.py:50: error: Name "var1" is not defined [name-defined]
20-
qualifiers_annotated.py:51: error: Invalid type: try using Literal[True] instead? [valid-type]
21-
qualifiers_annotated.py:52: error: Invalid type: try using Literal[1] instead? [valid-type]
22-
qualifiers_annotated.py:53: error: Invalid type comment or annotation [valid-type]
23-
qualifiers_annotated.py:54: error: Invalid type comment or annotation [valid-type]
24-
qualifiers_annotated.py:64: error: Annotated[...] must have exactly one type argument and at least one annotation [valid-type]
25-
qualifiers_annotated.py:76: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "type[Any]") [assignment]
26-
qualifiers_annotated.py:84: error: Argument 1 to "func4" has incompatible type "<typing special form>"; expected "type[Never]" [arg-type]
27-
qualifiers_annotated.py:91: error: "<typing special form>" not callable [operator]
28-
qualifiers_annotated.py:92: error: "<typing special form>" not callable [operator]
29-
qualifiers_annotated.py:98: error: Invalid type: ClassVar nested inside other type [valid-type]
30-
qualifiers_annotated.py:100: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]
24+
qualifiers_annotated.py:59: error: Annotated[...] must have exactly one type argument and at least one annotation [valid-type]
25+
qualifiers_annotated.py:71: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "type[Any]") [assignment]
26+
qualifiers_annotated.py:79: error: Argument 1 to "func4" has incompatible type "<typing special form>"; expected "type[Never]" [arg-type]
27+
qualifiers_annotated.py:86: error: "<typing special form>" not callable [operator]
28+
qualifiers_annotated.py:87: error: "<typing special form>" not callable [operator]
29+
qualifiers_annotated.py:93: error: Invalid type: ClassVar nested inside other type [valid-type]
30+
qualifiers_annotated.py:95: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]
3131
"""
3232
conformance_automated = "Fail"
3333
errors_diff = """
34-
Line 77: Expected 1 errors
35-
Line 85: Expected 1 errors
36-
Line 93: Expected 1 errors
37-
Line 98: Unexpected errors ['qualifiers_annotated.py:98: error: Invalid type: ClassVar nested inside other type [valid-type]']
38-
Line 100: Unexpected errors ['qualifiers_annotated.py:100: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]']
34+
Line 72: Expected 1 errors
35+
Line 80: Expected 1 errors
36+
Line 88: Expected 1 errors
37+
Line 93: Unexpected errors ['qualifiers_annotated.py:93: error: Invalid type: ClassVar nested inside other type [valid-type]']
38+
Line 95: Unexpected errors ['qualifiers_annotated.py:95: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]']
3939
"""

conformance/results/pyre/qualifiers_annotated.toml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ Does not reject Annotated with a single parameter.
44
Does not reject call of Annotated with no type arguments.
55
"""
66
output = """
7-
qualifiers_annotated.py:43:6 Undefined or invalid type [11]: Annotation `` is not defined as a type.
8-
qualifiers_annotated.py:44:6 Invalid type [31]: Expression `typing.Annotated[(((int, str)), "")]` is not a valid type.
9-
qualifiers_annotated.py:45:6 Invalid type [31]: Expression `typing.Annotated[(comprehension(int for generators(generator(i in range(1) if ))), "")]` is not a valid type.
10-
qualifiers_annotated.py:46:6 Invalid type [31]: Expression `typing.Annotated[({ "a":"b" }, "")]` is not a valid type.
11-
qualifiers_annotated.py:47:6 Invalid type [31]: Expression `typing.Annotated[(lambda () (int)(), "")]` is not a valid type.
12-
qualifiers_annotated.py:48:6 Invalid type [31]: Expression `typing.Annotated[([int][0], "")]` is not a valid type.
13-
qualifiers_annotated.py:49:6 Invalid type [31]: Expression `typing.Annotated[(int if 1 < 3 else str, "")]` is not a valid type.
14-
qualifiers_annotated.py:50:16 Unbound name [10]: Name `var1` is used but not defined in the current scope.
15-
qualifiers_annotated.py:51:6 Invalid type [31]: Expression `typing.Annotated[(True, "")]` is not a valid type.
16-
qualifiers_annotated.py:52:7 Invalid type [31]: Expression `typing.Annotated[(1, "")]` is not a valid type.
17-
qualifiers_annotated.py:53:7 Invalid type [31]: Expression `typing.Annotated[(list or set, "")]` is not a valid type.
18-
qualifiers_annotated.py:54:7 Invalid type [31]: Expression `typing.Annotated[(f"{"int"}", "")]` is not a valid type.
19-
qualifiers_annotated.py:64:7 Invalid type parameters [24]: Generic type `Annotated` expects at least 2 type parameters, received 1.
20-
qualifiers_annotated.py:77:0 Incompatible variable type [9]: not_type2 is declared to have type `Type[typing.Any]` but is used as type `TypeAlias`.
21-
qualifiers_annotated.py:85:6 Incompatible parameter type [6]: In call `func4`, for 1st positional argument, expected `Type[Variable[T]]` but got `TypeAlias`.
22-
qualifiers_annotated.py:91:0 Invalid class instantiation [45]: `Annotated` cannot be instantiated.
23-
qualifiers_annotated.py:93:0 Call error [29]: `TypeAlias` is not a function.
24-
qualifiers_annotated.py:105:4 Undefined attribute [16]: `typing.Type` has no attribute `a`.
25-
qualifiers_annotated.py:106:4 Undefined attribute [16]: `typing.Type` has no attribute `b`.
7+
qualifiers_annotated.py:38:6 Undefined or invalid type [11]: Annotation `` is not defined as a type.
8+
qualifiers_annotated.py:39:6 Invalid type [31]: Expression `typing.Annotated[(((int, str)), "")]` is not a valid type.
9+
qualifiers_annotated.py:40:6 Invalid type [31]: Expression `typing.Annotated[(comprehension(int for generators(generator(i in range(1) if ))), "")]` is not a valid type.
10+
qualifiers_annotated.py:41:6 Invalid type [31]: Expression `typing.Annotated[({ "a":"b" }, "")]` is not a valid type.
11+
qualifiers_annotated.py:42:6 Invalid type [31]: Expression `typing.Annotated[(lambda () (int)(), "")]` is not a valid type.
12+
qualifiers_annotated.py:43:6 Invalid type [31]: Expression `typing.Annotated[([int][0], "")]` is not a valid type.
13+
qualifiers_annotated.py:44:6 Invalid type [31]: Expression `typing.Annotated[(int if 1 < 3 else str, "")]` is not a valid type.
14+
qualifiers_annotated.py:45:16 Unbound name [10]: Name `var1` is used but not defined in the current scope.
15+
qualifiers_annotated.py:46:6 Invalid type [31]: Expression `typing.Annotated[(True, "")]` is not a valid type.
16+
qualifiers_annotated.py:47:7 Invalid type [31]: Expression `typing.Annotated[(1, "")]` is not a valid type.
17+
qualifiers_annotated.py:48:7 Invalid type [31]: Expression `typing.Annotated[(list or set, "")]` is not a valid type.
18+
qualifiers_annotated.py:49:7 Invalid type [31]: Expression `typing.Annotated[(f"{"int"}", "")]` is not a valid type.
19+
qualifiers_annotated.py:59:7 Invalid type parameters [24]: Generic type `Annotated` expects at least 2 type parameters, received 1.
20+
qualifiers_annotated.py:72:0 Incompatible variable type [9]: not_type2 is declared to have type `Type[typing.Any]` but is used as type `TypeAlias`.
21+
qualifiers_annotated.py:80:6 Incompatible parameter type [6]: In call `func4`, for 1st positional argument, expected `Type[Variable[T]]` but got `TypeAlias`.
22+
qualifiers_annotated.py:86:0 Invalid class instantiation [45]: `Annotated` cannot be instantiated.
23+
qualifiers_annotated.py:88:0 Call error [29]: `TypeAlias` is not a function.
24+
qualifiers_annotated.py:100:4 Undefined attribute [16]: `typing.Type` has no attribute `a`.
25+
qualifiers_annotated.py:101:4 Undefined attribute [16]: `typing.Type` has no attribute `b`.
2626
"""
2727
conformance_automated = "Fail"
2828
errors_diff = """
29-
Line 76: Expected 1 errors
30-
Line 84: Expected 1 errors
31-
Line 92: Expected 1 errors
32-
Line 105: Unexpected errors ['qualifiers_annotated.py:105:4 Undefined attribute [16]: `typing.Type` has no attribute `a`.']
33-
Line 106: Unexpected errors ['qualifiers_annotated.py:106:4 Undefined attribute [16]: `typing.Type` has no attribute `b`.']
29+
Line 71: Expected 1 errors
30+
Line 79: Expected 1 errors
31+
Line 87: Expected 1 errors
32+
Line 100: Unexpected errors ['qualifiers_annotated.py:100:4 Undefined attribute [16]: `typing.Type` has no attribute `a`.']
33+
Line 101: Unexpected errors ['qualifiers_annotated.py:101:4 Undefined attribute [16]: `typing.Type` has no attribute `b`.']
3434
"""

conformance/results/pyrefly/qualifiers_annotated.toml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ Allows Annotated in some contexts where it should not be allowed
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 76: Expected 1 errors
8-
Line 77: Expected 1 errors
9-
Line 84: Expected 1 errors
10-
Line 85: Expected 1 errors
11-
Line 92: Expected 1 errors
12-
Line 93: Expected 1 errors
7+
Line 71: Expected 1 errors
8+
Line 72: Expected 1 errors
9+
Line 79: Expected 1 errors
10+
Line 80: Expected 1 errors
11+
Line 87: Expected 1 errors
12+
Line 88: Expected 1 errors
1313
"""
1414
output = """
15-
ERROR qualifiers_annotated.py:43:17-27: list literal cannot be used in annotations [invalid-annotation]
16-
ERROR qualifiers_annotated.py:44:17-30: tuple literal cannot be used in annotations [invalid-annotation]
17-
ERROR qualifiers_annotated.py:45:17-40: list comprehension cannot be used in annotations [invalid-annotation]
18-
ERROR qualifiers_annotated.py:46:17-27: dict literal cannot be used in annotations [invalid-annotation]
19-
ERROR qualifiers_annotated.py:46:19-20: Could not find name `a` [unknown-name]
20-
ERROR qualifiers_annotated.py:46:24-25: Could not find name `b` [unknown-name]
21-
ERROR qualifiers_annotated.py:47:17-32: function call cannot be used in annotations [invalid-annotation]
22-
ERROR qualifiers_annotated.py:48:17-25: invalid subscript expression cannot be used in annotations [invalid-annotation]
23-
ERROR qualifiers_annotated.py:49:17-38: if expression cannot be used in annotations [invalid-annotation]
24-
ERROR qualifiers_annotated.py:50:17-21: Could not find name `var1` [unknown-name]
25-
ERROR qualifiers_annotated.py:51:17-21: bool literal cannot be used in annotations [invalid-annotation]
26-
ERROR qualifiers_annotated.py:52:18-19: number literal cannot be used in annotations [invalid-annotation]
27-
ERROR qualifiers_annotated.py:53:18-29: boolean operation cannot be used in annotations [invalid-annotation]
28-
ERROR qualifiers_annotated.py:54:18-28: f-string cannot be used in annotations [invalid-annotation]
29-
ERROR qualifiers_annotated.py:64:8-22: `Annotated` needs at least one piece of metadata in addition to the type [invalid-annotation]
30-
ERROR qualifiers_annotated.py:91:1-10: Expected a callable, got type[Annotated] [not-callable]
15+
ERROR qualifiers_annotated.py:38:17-27: list literal cannot be used in annotations [invalid-annotation]
16+
ERROR qualifiers_annotated.py:39:17-30: tuple literal cannot be used in annotations [invalid-annotation]
17+
ERROR qualifiers_annotated.py:40:17-40: list comprehension cannot be used in annotations [invalid-annotation]
18+
ERROR qualifiers_annotated.py:41:17-27: dict literal cannot be used in annotations [invalid-annotation]
19+
ERROR qualifiers_annotated.py:41:19-20: Could not find name `a` [unknown-name]
20+
ERROR qualifiers_annotated.py:41:24-25: Could not find name `b` [unknown-name]
21+
ERROR qualifiers_annotated.py:42:17-32: function call cannot be used in annotations [invalid-annotation]
22+
ERROR qualifiers_annotated.py:43:17-25: invalid subscript expression cannot be used in annotations [invalid-annotation]
23+
ERROR qualifiers_annotated.py:44:17-38: if expression cannot be used in annotations [invalid-annotation]
24+
ERROR qualifiers_annotated.py:45:17-21: Could not find name `var1` [unknown-name]
25+
ERROR qualifiers_annotated.py:46:17-21: bool literal cannot be used in annotations [invalid-annotation]
26+
ERROR qualifiers_annotated.py:47:18-19: number literal cannot be used in annotations [invalid-annotation]
27+
ERROR qualifiers_annotated.py:48:18-29: boolean operation cannot be used in annotations [invalid-annotation]
28+
ERROR qualifiers_annotated.py:49:18-28: f-string cannot be used in annotations [invalid-annotation]
29+
ERROR qualifiers_annotated.py:59:8-22: `Annotated` needs at least one piece of metadata in addition to the type [invalid-annotation]
30+
ERROR qualifiers_annotated.py:86:1-10: Expected a callable, got `type[Annotated]` [not-callable]
3131
"""

conformance/results/pyright/qualifiers_annotated.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
conformant = "Pass"
22
output = """
3-
qualifiers_annotated.py:43:17 - error: List expression not allowed for this type argument (reportInvalidTypeForm)
4-
qualifiers_annotated.py:44:17 - error: Expected class but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues)
5-
qualifiers_annotated.py:45:17 - error: List expression not allowed for this type argument (reportInvalidTypeForm)
6-
qualifiers_annotated.py:45:18 - error: Expected class but received "Generator[type[int], None, None]" (reportGeneralTypeIssues)
7-
qualifiers_annotated.py:46:17 - error: Expected class but received "dict[str, Unknown]" (reportGeneralTypeIssues)
8-
qualifiers_annotated.py:46:17 - error: Dictionary expression not allowed in type expression (reportInvalidTypeForm)
9-
qualifiers_annotated.py:46:24 - error: "b" is not defined (reportUndefinedVariable)
10-
qualifiers_annotated.py:47:17 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
11-
qualifiers_annotated.py:48:17 - error: List expression not allowed in type expression
3+
qualifiers_annotated.py:38:17 - error: List expression not allowed for this type argument (reportInvalidTypeForm)
4+
qualifiers_annotated.py:39:17 - error: Expected class but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues)
5+
qualifiers_annotated.py:40:17 - error: List expression not allowed for this type argument (reportInvalidTypeForm)
6+
qualifiers_annotated.py:40:18 - error: Expected class but received "Generator[type[int], None, None]" (reportGeneralTypeIssues)
7+
qualifiers_annotated.py:41:17 - error: Expected class but received "dict[str, Unknown]" (reportGeneralTypeIssues)
8+
qualifiers_annotated.py:41:17 - error: Dictionary expression not allowed in type expression (reportInvalidTypeForm)
9+
qualifiers_annotated.py:41:24 - error: "b" is not defined (reportUndefinedVariable)
10+
qualifiers_annotated.py:42:17 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
11+
qualifiers_annotated.py:43:17 - error: List expression not allowed in type expression
1212
  Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)
13-
qualifiers_annotated.py:48:17 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
14-
qualifiers_annotated.py:48:23 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
15-
qualifiers_annotated.py:49:17 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
16-
qualifiers_annotated.py:50:17 - error: "var1" is not defined (reportUndefinedVariable)
17-
qualifiers_annotated.py:51:17 - error: Expected class but received "Literal[True]" (reportGeneralTypeIssues)
18-
qualifiers_annotated.py:52:18 - error: Expected class but received "Literal[1]" (reportGeneralTypeIssues)
19-
qualifiers_annotated.py:53:18 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
20-
qualifiers_annotated.py:54:18 - error: Type expressions cannot use format string literals (f-strings) (reportGeneralTypeIssues)
21-
qualifiers_annotated.py:64:8 - error: Expected one type argument and one or more annotations for "Annotated" (reportInvalidTypeForm)
22-
qualifiers_annotated.py:76:24 - error: Type "Annotated" is not assignable to declared type "type[Any]"
13+
qualifiers_annotated.py:43:17 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
14+
qualifiers_annotated.py:43:23 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
15+
qualifiers_annotated.py:44:17 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
16+
qualifiers_annotated.py:45:17 - error: "var1" is not defined (reportUndefinedVariable)
17+
qualifiers_annotated.py:46:17 - error: Expected class but received "Literal[True]" (reportGeneralTypeIssues)
18+
qualifiers_annotated.py:47:18 - error: Expected class but received "Literal[1]" (reportGeneralTypeIssues)
19+
qualifiers_annotated.py:48:18 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
20+
qualifiers_annotated.py:49:18 - error: Type expressions cannot use format string literals (f-strings) (reportGeneralTypeIssues)
21+
qualifiers_annotated.py:59:8 - error: Expected one type argument and one or more annotations for "Annotated" (reportInvalidTypeForm)
22+
qualifiers_annotated.py:71:24 - error: Type "Annotated" is not assignable to declared type "type[Any]"
2323
  "Annotated" is not assignable to "type[Any]" (reportAssignmentType)
24-
qualifiers_annotated.py:77:24 - error: Type "SmallInt" is not assignable to declared type "type[Any]"
24+
qualifiers_annotated.py:72:24 - error: Type "SmallInt" is not assignable to declared type "type[Any]"
2525
  "Annotated" is not assignable to "type[Any]" (reportAssignmentType)
26-
qualifiers_annotated.py:84:7 - error: Argument of type "Annotated" cannot be assigned to parameter "x" of type "type[T@func4]" in function "func4"
26+
qualifiers_annotated.py:79:7 - error: Argument of type "Annotated" cannot be assigned to parameter "x" of type "type[T@func4]" in function "func4"
2727
  Type "Annotated" is not assignable to type "type[T@func4]" (reportArgumentType)
28-
qualifiers_annotated.py:85:7 - error: Argument of type "SmallInt" cannot be assigned to parameter "x" of type "type[T@func4]" in function "func4"
28+
qualifiers_annotated.py:80:7 - error: Argument of type "SmallInt" cannot be assigned to parameter "x" of type "type[T@func4]" in function "func4"
2929
  Type "Annotated" is not assignable to type "type[T@func4]" (reportArgumentType)
30-
qualifiers_annotated.py:91:1 - error: "Annotated" cannot be instantiated (reportCallIssue)
31-
qualifiers_annotated.py:92:1 - error: Object of type "Annotated" is not callable
30+
qualifiers_annotated.py:86:1 - error: "Annotated" cannot be instantiated (reportCallIssue)
31+
qualifiers_annotated.py:87:1 - error: Object of type "Annotated" is not callable
3232
  Attribute "__call__" is unknown (reportCallIssue)
33-
qualifiers_annotated.py:93:1 - error: Object of type "Annotated" is not callable (reportCallIssue)
33+
qualifiers_annotated.py:88:1 - error: Object of type "Annotated" is not callable (reportCallIssue)
3434
"""
3535
conformance_automated = "Pass"
3636
errors_diff = """

0 commit comments

Comments
 (0)