Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update conformance test sources to initialize uninitialized variables #1804

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions conformance/results/mypy/annotations_forward_refs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ annotations_forward_refs.py:87: error: Function "annotations_forward_refs.ClassD
annotations_forward_refs.py:87: note: Perhaps you need "Callable[...]" or a callback protocol?
annotations_forward_refs.py:89: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type]
annotations_forward_refs.py:89: note: Perhaps you need "Callable[...]" or a callback protocol?
annotations_forward_refs.py:93: error: Expression is of type int?, not "int" [assert-type]
annotations_forward_refs.py:91: error: Variable "annotations_forward_refs.ClassD.ClassC" is not valid as a type [valid-type]
annotations_forward_refs.py:91: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
annotations_forward_refs.py:96: error: Expression is of type int?, not "int" [assert-type]
"""
conformance_automated = "Fail"
errors_diff = """
Expand All @@ -37,5 +39,6 @@ Line 24: Expected 1 errors
Line 25: Expected 1 errors
Line 66: Expected 1 errors
Line 87: Unexpected errors ['annotations_forward_refs.py:87: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type]']
Line 93: Unexpected errors ['annotations_forward_refs.py:93: error: Expression is of type int?, not "int" [assert-type]']
Line 91: Unexpected errors ['annotations_forward_refs.py:91: error: Variable "annotations_forward_refs.ClassD.ClassC" is not valid as a type [valid-type]']
Line 96: Unexpected errors ['annotations_forward_refs.py:96: error: Expression is of type int?, not "int" [assert-type]']
"""
12 changes: 6 additions & 6 deletions conformance/results/mypy/classes_classvar.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ classes_classvar.py:65: error: ClassVar can only be used for assignments in clas
classes_classvar.py:67: error: ClassVar can only be used for assignments in class body [misc]
classes_classvar.py:71: error: ClassVar can only be used for assignments in class body [misc]
classes_classvar.py:78: error: Expression is of type "Any", not "float" [assert-type]
classes_classvar.py:102: error: Cannot assign to class variable "stats" via instance [misc]
classes_classvar.py:131: error: Incompatible types in assignment (expression has type "ProtoAImpl", variable has type "ProtoA") [assignment]
classes_classvar.py:131: note: "ProtoAImpl" is missing following "ProtoA" protocol member:
classes_classvar.py:131: note: z
classes_classvar.py:131: note: Protocol member ProtoA.x expected class variable, got instance variable
classes_classvar.py:131: note: Protocol member ProtoA.y expected class variable, got instance variable
classes_classvar.py:105: error: Cannot assign to class variable "stats" via instance [misc]
classes_classvar.py:134: error: Incompatible types in assignment (expression has type "ProtoAImpl", variable has type "ProtoA") [assignment]
classes_classvar.py:134: note: "ProtoAImpl" is missing following "ProtoA" protocol member:
classes_classvar.py:134: note: z
classes_classvar.py:134: note: Protocol member ProtoA.x expected class variable, got instance variable
classes_classvar.py:134: note: Protocol member ProtoA.y expected class variable, got instance variable
"""
conformance_automated = "Fail"
errors_diff = """
Expand Down
12 changes: 6 additions & 6 deletions conformance/results/mypy/dataclasses_transform_class.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
conformant = "Pass"
output = """
dataclasses_transform_class.py:48: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_class.py:60: error: Property "id" defined in "Customer1" is read-only [misc]
dataclasses_transform_class.py:63: error: Too many positional arguments for "Customer1" [misc]
dataclasses_transform_class.py:69: error: Unsupported left operand type for < ("Customer1") [operator]
dataclasses_transform_class.py:79: error: Too many positional arguments for "Customer2" [misc]
dataclasses_transform_class.py:119: error: Property "id" defined in "Customer3" is read-only [misc]
dataclasses_transform_class.py:51: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_class.py:63: error: Property "id" defined in "Customer1" is read-only [misc]
dataclasses_transform_class.py:66: error: Too many positional arguments for "Customer1" [misc]
dataclasses_transform_class.py:72: error: Unsupported left operand type for < ("Customer1") [operator]
dataclasses_transform_class.py:82: error: Too many positional arguments for "Customer2" [misc]
dataclasses_transform_class.py:122: error: Property "id" defined in "Customer3" is read-only [misc]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
12 changes: 6 additions & 6 deletions conformance/results/mypy/dataclasses_transform_meta.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
conformant = "Pass"
output = """
dataclasses_transform_meta.py:48: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_meta.py:60: error: Property "id" defined in "Customer1" is read-only [misc]
dataclasses_transform_meta.py:63: error: Too many positional arguments for "Customer1" [misc]
dataclasses_transform_meta.py:70: error: Unsupported left operand type for < ("Customer1") [operator]
dataclasses_transform_meta.py:80: error: Too many positional arguments for "Customer2" [misc]
dataclasses_transform_meta.py:100: error: Property "id" defined in "Customer3" is read-only [misc]
dataclasses_transform_meta.py:51: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_meta.py:63: error: Property "id" defined in "Customer1" is read-only [misc]
dataclasses_transform_meta.py:66: error: Too many positional arguments for "Customer1" [misc]
dataclasses_transform_meta.py:73: error: Unsupported left operand type for < ("Customer1") [operator]
dataclasses_transform_meta.py:83: error: Too many positional arguments for "Customer2" [misc]
dataclasses_transform_meta.py:103: error: Property "id" defined in "Customer3" is read-only [misc]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
6 changes: 3 additions & 3 deletions conformance/results/mypy/dataclasses_usage.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dataclasses_usage.py:67: error: Attributes without a default cannot follow attri
dataclasses_usage.py:73: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:83: error: Too many arguments for "DC4" [call-arg]
dataclasses_usage.py:88: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
dataclasses_usage.py:126: error: Too many arguments for "DC7" [call-arg]
dataclasses_usage.py:129: error: Missing positional argument "y" in call to "DC8" [call-arg]
dataclasses_usage.py:178: error: Too many arguments for "DC13" [call-arg]
dataclasses_usage.py:127: error: Too many arguments for "DC7" [call-arg]
dataclasses_usage.py:130: error: Missing positional argument "y" in call to "DC8" [call-arg]
dataclasses_usage.py:179: error: Too many arguments for "DC13" [call-arg]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
54 changes: 27 additions & 27 deletions conformance/results/mypy/enums_members.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ Does not support `_ignore_` mechanism (optional).
"""
conformance_automated = "Fail"
errors_diff = """
Line 46: Expected 1 errors
Line 78: Expected 1 errors
Line 79: Expected 1 errors
Line 112: Expected 1 errors
Line 23: Unexpected errors ['enums_members.py:23: error: Expression is of type "Literal[Pet.genus]", not "str" [assert-type]']
Line 24: Unexpected errors ['enums_members.py:24: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]']
Line 31: Unexpected errors ['enums_members.py:31: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]']
Line 32: Unexpected errors ['enums_members.py:32: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]']
Line 96: Unexpected errors ['enums_members.py:96: error: Expression is of type "Literal[TrafficLight.AMBER]", not "Literal[TrafficLight.YELLOW]" [assert-type]']
Line 113: Unexpected errors ['enums_members.py:113: error: Expression is of type "member[Callable[[Example], None]]", not "Any" [assert-type]', 'enums_members.py:113: error: Parameter 1 of Literal[...] is invalid [valid-type]']
Line 50: Expected 1 errors
Line 82: Expected 1 errors
Line 83: Expected 1 errors
Line 116: Expected 1 errors
Line 27: Unexpected errors ['enums_members.py:27: error: Expression is of type "Literal[Pet.genus]", not "str" [assert-type]']
Line 28: Unexpected errors ['enums_members.py:28: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]']
Line 35: Unexpected errors ['enums_members.py:35: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]']
Line 36: Unexpected errors ['enums_members.py:36: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]']
Line 100: Unexpected errors ['enums_members.py:100: error: Expression is of type "Literal[TrafficLight.AMBER]", not "Literal[TrafficLight.YELLOW]" [assert-type]']
Line 117: Unexpected errors ['enums_members.py:117: error: Expression is of type "member[Callable[[Example], None]]", not "Any" [assert-type]', 'enums_members.py:117: error: Parameter 1 of Literal[...] is invalid [valid-type]']
"""
output = """
enums_members.py:23: error: Expression is of type "Literal[Pet.genus]", not "str" [assert-type]
enums_members.py:24: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]
enums_members.py:31: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]
enums_members.py:32: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]
enums_members.py:80: error: Expression is of type "Callable[[Pet4], str]", not "Any" [assert-type]
enums_members.py:80: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:81: error: Expression is of type "Callable[[Pet4], None]", not "Any" [assert-type]
enums_members.py:81: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:96: error: Expression is of type "Literal[TrafficLight.AMBER]", not "Literal[TrafficLight.YELLOW]" [assert-type]
enums_members.py:113: error: Expression is of type "member[Callable[[Example], None]]", not "Any" [assert-type]
enums_members.py:113: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:124: note: Revealed type is "Any"
enums_members.py:124: note: 'reveal_type' always outputs 'Any' in unchecked functions
enums_members.py:125: error: Expression is of type "Any", not "Literal[Example2.__B]" [assert-type]
enums_members.py:125: note: "assert_type" expects everything to be "Any" in unchecked functions
enums_members.py:142: error: Expression is of type "Literal[Pet5.DOG]", not "int" [assert-type]
enums_members.py:143: error: Expression is of type "Literal[Pet5.FISH]", not "int" [assert-type]
enums_members.py:27: error: Expression is of type "Literal[Pet.genus]", not "str" [assert-type]
enums_members.py:28: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]
enums_members.py:35: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]
enums_members.py:36: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]
enums_members.py:84: error: Expression is of type "Callable[[Pet4], str]", not "Any" [assert-type]
enums_members.py:84: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:85: error: Expression is of type "Callable[[Pet4], None]", not "Any" [assert-type]
enums_members.py:85: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:100: error: Expression is of type "Literal[TrafficLight.AMBER]", not "Literal[TrafficLight.YELLOW]" [assert-type]
enums_members.py:117: error: Expression is of type "member[Callable[[Example], None]]", not "Any" [assert-type]
enums_members.py:117: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:128: note: Revealed type is "Any"
enums_members.py:128: note: 'reveal_type' always outputs 'Any' in unchecked functions
enums_members.py:129: error: Expression is of type "Any", not "Literal[Example2.__B]" [assert-type]
enums_members.py:129: note: "assert_type" expects everything to be "Any" in unchecked functions
enums_members.py:146: error: Expression is of type "Literal[Pet5.DOG]", not "int" [assert-type]
enums_members.py:147: error: Expression is of type "Literal[Pet5.FISH]", not "int" [assert-type]
"""
20 changes: 10 additions & 10 deletions conformance/results/mypy/generics_scoping.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ generics_scoping.py:65: error: Free type variable expected in Generic[...] [mis
generics_scoping.py:78: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:78: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:78: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:84: error: Can't use bound type variable "T" to define generic alias [valid-type]
generics_scoping.py:88: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:88: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:88: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:89: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:89: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:89: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:90: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:90: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:90: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:87: error: Can't use bound type variable "T" to define generic alias [valid-type]
generics_scoping.py:94: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:94: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:94: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:95: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:95: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:95: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_scoping.py:96: error: Type variable "generics_scoping.T" is unbound [valid-type]
generics_scoping.py:96: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_scoping.py:96: note: (Hint: Use "T" in function signature to bind "T" inside a function)
"""
conformance_automated = "Fail"
errors_diff = """
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/mypy/generics_self_basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ conformant = "Pass"
output = """
generics_self_basic.py:20: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
generics_self_basic.py:33: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
generics_self_basic.py:64: error: Self type cannot have type arguments [misc]
generics_self_basic.py:67: error: Self type cannot have type arguments [misc]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
18 changes: 9 additions & 9 deletions conformance/results/mypy/generics_type_erasure.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ Infers Node[Never] instead of Node[Any] when argument is not provided.
False negative on instance attribute access on type(node).
"""
output = """
generics_type_erasure.py:17: error: Expression is of type "Node[Never]", not "Node[Any]" [assert-type]
generics_type_erasure.py:20: error: Expression is of type Never, not "Any" [assert-type]
generics_type_erasure.py:36: error: Argument 1 to "Node" has incompatible type "str"; expected "int | None" [arg-type]
generics_type_erasure.py:38: error: Argument 1 to "Node" has incompatible type "int"; expected "str | None" [arg-type]
generics_type_erasure.py:40: error: Access to generic instance variables via class is ambiguous [misc]
generics_type_erasure.py:41: error: Access to generic instance variables via class is ambiguous [misc]
generics_type_erasure.py:19: error: Expression is of type "Node[Never]", not "Node[Any]" [assert-type]
generics_type_erasure.py:22: error: Expression is of type Never, not "Any" [assert-type]
generics_type_erasure.py:38: error: Argument 1 to "Node" has incompatible type "str"; expected "int | None" [arg-type]
generics_type_erasure.py:40: error: Argument 1 to "Node" has incompatible type "int"; expected "str | None" [arg-type]
generics_type_erasure.py:42: error: Access to generic instance variables via class is ambiguous [misc]
generics_type_erasure.py:43: error: Access to generic instance variables via class is ambiguous [misc]
generics_type_erasure.py:44: error: Access to generic instance variables via class is ambiguous [misc]
generics_type_erasure.py:45: error: Access to generic instance variables via class is ambiguous [misc]
"""
conformance_automated = "Fail"
errors_diff = """
Line 44: Expected 1 errors
Line 17: Unexpected errors ['generics_type_erasure.py:17: error: Expression is of type "Node[Never]", not "Node[Any]" [assert-type]']
Line 20: Unexpected errors ['generics_type_erasure.py:20: error: Expression is of type Never, not "Any" [assert-type]']
Line 46: Expected 1 errors
Line 19: Unexpected errors ['generics_type_erasure.py:19: error: Expression is of type "Node[Never]", not "Node[Any]" [assert-type]']
Line 22: Unexpected errors ['generics_type_erasure.py:22: error: Expression is of type Never, not "Any" [assert-type]']
"""
16 changes: 8 additions & 8 deletions conformance/results/mypy/protocols_class_objects.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ protocols_class_objects.py:74: error: Incompatible types in assignment (expressi
protocols_class_objects.py:74: note: Following member(s) of "ConcreteB" have conflicts:
protocols_class_objects.py:74: note: prop1: expected "int", got "Callable[[ConcreteB], int]"
protocols_class_objects.py:74: note: Only class variables allowed for class object access on protocols, prop1 is an instance variable of "ConcreteB"
protocols_class_objects.py:101: error: Incompatible types in assignment (expression has type "type[ConcreteC1]", variable has type "ProtoC1") [assignment]
protocols_class_objects.py:101: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object
protocols_class_objects.py:103: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC1") [assignment]
protocols_class_objects.py:103: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2"
protocols_class_objects.py:103: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object
protocols_class_objects.py:104: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC2") [assignment]
protocols_class_objects.py:104: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2"
protocols_class_objects.py:105: error: Incompatible types in assignment (expression has type "type[ConcreteC3]", variable has type "ProtoC1") [assignment]
protocols_class_objects.py:104: error: Incompatible types in assignment (expression has type "type[ConcreteC1]", variable has type "ProtoC1") [assignment]
protocols_class_objects.py:104: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object
protocols_class_objects.py:106: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC1") [assignment]
protocols_class_objects.py:106: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2"
protocols_class_objects.py:106: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object
protocols_class_objects.py:107: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC2") [assignment]
protocols_class_objects.py:107: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2"
protocols_class_objects.py:108: error: Incompatible types in assignment (expression has type "type[ConcreteC3]", variable has type "ProtoC1") [assignment]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
Loading