Skip to content

Commit ecc2129

Browse files
authored
Update conformance tests (#2095)
* Update unexpected_fails.py to allow omitting the `conformant` field for passing tests. * Add pyrefly.toml. * Update results for pyrefly 0.36.2. * Update manual conformance. * Fixes to tests for type errors and incorrect expectations. * Regenerate results. * Address review comments. * Remove no-longer-needed import.
1 parent 89f5f7c commit ecc2129

File tree

92 files changed

+450
-652
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+450
-652
lines changed

conformance/results/mypy/classes_classvar.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ output = """
99
classes_classvar.py:38: error: ClassVar[...] must have at most one type argument [valid-type]
1010
classes_classvar.py:39: error: Invalid type: try using Literal[3] instead? [valid-type]
1111
classes_classvar.py:40: error: Name "var" is not defined [name-defined]
12-
classes_classvar.py:45: error: ClassVar cannot contain type variables [misc]
13-
classes_classvar.py:46: error: ClassVar cannot contain type variables [misc]
1412
classes_classvar.py:52: error: Incompatible types in assignment (expression has type "dict[Never, Never]", variable has type "list[str]") [assignment]
1513
classes_classvar.py:54: error: Variable should not be annotated with both ClassVar and Final [misc]
1614
classes_classvar.py:55: error: Invalid type: ClassVar nested inside other type [valid-type]
@@ -22,6 +20,7 @@ classes_classvar.py:73: error: ClassVar can only be used for assignments in clas
2220
classes_classvar.py:77: error: ClassVar can only be used for assignments in class body [misc]
2321
classes_classvar.py:78: error: ClassVar[...] can't be used inside a type alias [valid-type]
2422
classes_classvar.py:111: error: Cannot assign to class variable "stats" via instance [misc]
23+
classes_classvar.py:130: error: All protocol members must have explicitly declared types [misc]
2524
classes_classvar.py:140: error: Incompatible types in assignment (expression has type "ProtoAImpl", variable has type "ProtoA") [assignment]
2625
classes_classvar.py:140: note: "ProtoAImpl" is missing following "ProtoA" protocol member:
2726
classes_classvar.py:140: note: z
@@ -30,6 +29,9 @@ classes_classvar.py:140: note: Protocol member ProtoA.y expected class variable,
3029
"""
3130
conformance_automated = "Fail"
3231
errors_diff = """
32+
Line 45: Expected 1 errors
33+
Line 46: Expected 1 errors
3334
Line 47: Expected 1 errors
3435
Line 67: Unexpected errors ['classes_classvar.py:67: error: Invalid type: ClassVar nested inside other type [valid-type]']
36+
Line 130: Unexpected errors ['classes_classvar.py:130: error: All protocol members must have explicitly declared types [misc]']
3537
"""

conformance/results/mypy/constructors_call_metaclass.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Does not skip evaluation of __new__ and __init__ if custom metaclass call return
55
"""
66
conformance_automated = "Fail"
77
errors_diff = """
8-
Line 23: Unexpected errors ['constructors_call_metaclass.py:23: error: Expression is of type "Class1", not "Never" [assert-type]', 'constructors_call_metaclass.py:23: error: Missing positional argument "x" in call to "Class1" [call-arg]']
9-
Line 36: Unexpected errors ['constructors_call_metaclass.py:36: error: Expression is of type "Class2", not "int | Meta2" [assert-type]', 'constructors_call_metaclass.py:36: error: Missing positional argument "x" in call to "Class2" [call-arg]']
10-
Line 43: Unexpected errors ['constructors_call_metaclass.py:43: error: Argument 2 for "super" not an instance of argument 1 [misc]']
8+
Line 26: Unexpected errors ['constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]', 'constructors_call_metaclass.py:26: error: Missing positional argument "x" in call to "Class1" [call-arg]']
9+
Line 39: Unexpected errors ['constructors_call_metaclass.py:39: error: Expression is of type "Class2", not "int | Meta2" [assert-type]', 'constructors_call_metaclass.py:39: error: Missing positional argument "x" in call to "Class2" [call-arg]']
10+
Line 46: Unexpected errors ['constructors_call_metaclass.py:46: error: Argument 2 for "super" not an instance of argument 1 [misc]']
1111
"""
1212
output = """
13-
constructors_call_metaclass.py:23: error: Expression is of type "Class1", not "Never" [assert-type]
14-
constructors_call_metaclass.py:23: error: Missing positional argument "x" in call to "Class1" [call-arg]
15-
constructors_call_metaclass.py:36: error: Expression is of type "Class2", not "int | Meta2" [assert-type]
16-
constructors_call_metaclass.py:36: error: Missing positional argument "x" in call to "Class2" [call-arg]
17-
constructors_call_metaclass.py:43: error: Argument 2 for "super" not an instance of argument 1 [misc]
18-
constructors_call_metaclass.py:51: error: Missing positional argument "x" in call to "Class3" [call-arg]
19-
constructors_call_metaclass.py:65: error: Missing positional argument "x" in call to "Class4" [call-arg]
13+
constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]
14+
constructors_call_metaclass.py:26: error: Missing positional argument "x" in call to "Class1" [call-arg]
15+
constructors_call_metaclass.py:39: error: Expression is of type "Class2", not "int | Meta2" [assert-type]
16+
constructors_call_metaclass.py:39: error: Missing positional argument "x" in call to "Class2" [call-arg]
17+
constructors_call_metaclass.py:46: error: Argument 2 for "super" not an instance of argument 1 [misc]
18+
constructors_call_metaclass.py:54: error: Missing positional argument "x" in call to "Class3" [call-arg]
19+
constructors_call_metaclass.py:68: error: Missing positional argument "x" in call to "Class4" [call-arg]
2020
"""

conformance/results/mypy/dataclasses_transform_converter.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ dataclasses_transform_converter.py:121: error: Argument 4 to "DC2" has incompati
4444
dataclasses_transform_converter.py:121: error: Argument 5 to "DC2" has incompatible type "str"; expected "int" [arg-type]
4545
dataclasses_transform_converter.py:121: error: Argument 6 to "DC2" has incompatible type "tuple[tuple[str, str], tuple[str, str]]"; expected "dict[str, str]" [arg-type]
4646
dataclasses_transform_converter.py:130: error: Argument "converter" to "model_field" has incompatible type "Callable[[str], int]"; expected "Callable[[int], int]" [arg-type]
47-
dataclasses_transform_converter.py:133: error: Cannot infer type argument 1 of "model_field" [misc]
47+
dataclasses_transform_converter.py:133: error: Cannot infer value of type parameter "S" of "model_field" [misc]
4848
"""

conformance/results/mypy/enums_member_values.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ enums_member_values.py:26: error: Expression is of type "Any", not "Literal[1, 3
1212
enums_member_values.py:54: error: Expression is of type "tuple[int, float, float]", not "Literal[1]" [assert-type]
1313
enums_member_values.py:68: error: Expression is of type "int", not "Literal[1]" [assert-type]
1414
enums_member_values.py:85: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
15-
enums_member_values.py:96: error: Expression is of type "EllipsisType", not "int" [assert-type]
1615
"""

conformance/results/mypy/generics_basic.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ generics_basic.py:162: error: Free type variable expected in Generic[...] [misc
1212
generics_basic.py:163: error: Free type variable expected in Protocol[...] [misc]
1313
generics_basic.py:171: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
1414
generics_basic.py:172: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
15-
generics_basic.py:208: error: Dynamic metaclass not supported for "GenericMetaInstance" [misc]
15+
generics_basic.py:208: error: Dynamic metaclass not supported for "GenericMetaInstance" [metaclass]
1616
generics_basic.py:208: error: Type variable "generics_basic.T" is unbound [valid-type]
1717
generics_basic.py:208: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
1818
generics_basic.py:208: note: (Hint: Use "T" in function signature to bind "T" inside a function)

conformance/results/mypy/generics_defaults.toml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[Defa
1414
generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]
1515
generics_defaults.py:107: error: TypeVar default must be a subtype of the bound type [misc]
1616
generics_defaults.py:114: error: TypeVar default must be one of the constraint types [misc]
17-
generics_defaults.py:154: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]
18-
generics_defaults.py:154: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
19-
generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]
17+
generics_defaults.py:131: error: Expression is of type "int", not "Any" [assert-type]
18+
generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]
2019
generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
21-
generics_defaults.py:169: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]
22-
generics_defaults.py:170: error: Expression is of type "Any", not "int" [assert-type]
23-
generics_defaults.py:170: error: Access to generic instance variables via class is ambiguous [misc]
20+
generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]
21+
generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
22+
generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]
2423
"""
2524
conformance_automated = "Fail"
2625
errors_diff = """
27-
Line 141: Expected 1 errors
26+
Line 142: Expected 1 errors
2827
Line 30: Unexpected errors ['generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[DefaultStrT, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
2928
Line 31: Unexpected errors ['generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[str, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
3029
Line 38: Unexpected errors ['generics_defaults.py:38: error: Expression is of type "type[OneDefault[float, DefaultBoolT]]", not "type[OneDefault[float, bool]]" [assert-type]']
@@ -35,8 +34,7 @@ Line 55: Unexpected errors ['generics_defaults.py:55: error: Expression is of ty
3534
Line 59: Unexpected errors ['generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[int, complex, str, int, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
3635
Line 79: Unexpected errors ['generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[DefaultP]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]']
3736
Line 94: Unexpected errors ['generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]']
38-
Line 154: Unexpected errors ['generics_defaults.py:154: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]', 'generics_defaults.py:154: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
39-
Line 155: Unexpected errors ['generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]', 'generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
40-
Line 169: Unexpected errors ['generics_defaults.py:169: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]']
41-
Line 170: Unexpected errors ['generics_defaults.py:170: error: Expression is of type "Any", not "int" [assert-type]', 'generics_defaults.py:170: error: Access to generic instance variables via class is ambiguous [misc]']
37+
Line 155: Unexpected errors ['generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]', 'generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
38+
Line 156: Unexpected errors ['generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]', 'generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
39+
Line 170: Unexpected errors ['generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]']
4240
"""

conformance/results/mypy/generics_scoping.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
conformant = "Partial"
2-
notes = """
3-
False negative on generic class nested within generic class with same type variable.
4-
"""
51
output = """
62
generics_scoping.py:29: error: Argument 1 to "meth_2" of "MyClass" has incompatible type "str"; expected "int" [arg-type]
73
generics_scoping.py:50: error: Type variable "generics_scoping.S" is unbound [valid-type]
@@ -11,6 +7,7 @@ generics_scoping.py:54: error: Type variable "generics_scoping.S" is unbound [v
117
generics_scoping.py:54: note: (Hint: Use "Generic[S]" or "Protocol[S]" base class to bind "S" inside a class)
128
generics_scoping.py:54: note: (Hint: Use "S" in function signature to bind "S" inside a function)
139
generics_scoping.py:65: error: Free type variable expected in Generic[...] [misc]
10+
generics_scoping.py:75: error: Type variable "T" is bound by an outer class [valid-type]
1411
generics_scoping.py:78: error: Type variable "generics_scoping.T" is unbound [valid-type]
1512
generics_scoping.py:78: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
1613
generics_scoping.py:78: note: (Hint: Use "T" in function signature to bind "T" inside a function)
@@ -25,7 +22,6 @@ generics_scoping.py:96: error: Type variable "generics_scoping.T" is unbound [v
2522
generics_scoping.py:96: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
2623
generics_scoping.py:96: note: (Hint: Use "T" in function signature to bind "T" inside a function)
2724
"""
28-
conformance_automated = "Fail"
25+
conformance_automated = "Pass"
2926
errors_diff = """
30-
Line 75: Expected 1 errors
3127
"""

conformance/results/mypy/generics_self_advanced.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ output = """
99
generics_self_advanced.py:35: error: Expression is of type "ChildB", not "Self" [assert-type]
1010
generics_self_advanced.py:38: error: Expression is of type "ChildB", not "Self" [assert-type]
1111
generics_self_advanced.py:42: error: Expression is of type "type[ChildB]", not "type[Self]" [assert-type]
12-
generics_self_advanced.py:43: error: Expression is of type "list[Any]", not "list[Self]" [assert-type]
13-
generics_self_advanced.py:44: error: Expression is of type "Any", not "Self" [assert-type]
1412
generics_self_advanced.py:45: error: Expression is of type "ChildB", not "Self" [assert-type]
1513
"""
1614
conformance_automated = "Fail"
1715
errors_diff = """
1816
Line 35: Unexpected errors ['generics_self_advanced.py:35: error: Expression is of type "ChildB", not "Self" [assert-type]']
1917
Line 38: Unexpected errors ['generics_self_advanced.py:38: error: Expression is of type "ChildB", not "Self" [assert-type]']
2018
Line 42: Unexpected errors ['generics_self_advanced.py:42: error: Expression is of type "type[ChildB]", not "type[Self]" [assert-type]']
21-
Line 43: Unexpected errors ['generics_self_advanced.py:43: error: Expression is of type "list[Any]", not "list[Self]" [assert-type]']
22-
Line 44: Unexpected errors ['generics_self_advanced.py:44: error: Expression is of type "Any", not "Self" [assert-type]']
2319
Line 45: Unexpected errors ['generics_self_advanced.py:45: error: Expression is of type "ChildB", not "Self" [assert-type]']
2420
"""

0 commit comments

Comments
 (0)