Skip to content

Commit

Permalink
update conformance tests to initialize uninitialized variables
Browse files Browse the repository at this point in the history
  • Loading branch information
yangdanny97 committed Jul 14, 2024
1 parent 5edf914 commit 684a6d2
Show file tree
Hide file tree
Showing 81 changed files with 515 additions and 486 deletions.
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
15 changes: 7 additions & 8 deletions conformance/results/mypy/dataclasses_transform_func.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ Does not handle `kw_only=False` override when `kw_only_default=True`.
Does not report error when `order=False` and comparison operators are used.
"""
output = """
dataclasses_transform_func.py:53: error: Too many positional arguments for "Customer1" [misc]
dataclasses_transform_func.py:57: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
dataclasses_transform_func.py:65: error: Unexpected keyword argument "salary" for "Customer1" [call-arg]
dataclasses_transform_func.py:71: error: Too many positional arguments for "Customer2" [misc]
dataclasses_transform_func.py:90: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_func.py:97: error: Property "id" defined in "Customer3" is read-only [misc]
dataclasses_transform_func.py:38: note: "Customer1" defined here
dataclasses_transform_func.py:68: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
dataclasses_transform_func.py:76: error: Unexpected keyword argument "salary" for "Customer1" [call-arg]
dataclasses_transform_func.py:101: error: Cannot inherit non-frozen dataclass from a frozen one [misc]
dataclasses_transform_func.py:111: error: Property "id" defined in "Customer3" is read-only [misc]
"""
conformance_automated = "Fail"
errors_diff = """
Line 61: Expected 1 errors
Line 53: Unexpected errors ['dataclasses_transform_func.py:53: error: Too many positional arguments for "Customer1" [misc]']
Line 72: Expected 1 errors
Line 82: Expected 1 errors
"""
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:183: error: Missing positional argument "x_squared" in call to "DC13" [call-arg]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
4 changes: 2 additions & 2 deletions conformance/results/mypy/enums_member_values.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ output = """
enums_member_values.py:26: error: Expression is of type "Any", not "Literal[1, 3]" [assert-type]
enums_member_values.py:54: error: Expression is of type "tuple[int, float, float]", not "Literal[1]" [assert-type]
enums_member_values.py:68: error: Expression is of type "int", not "Literal[1]" [assert-type]
enums_member_values.py:85: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
enums_member_values.py:96: error: Expression is of type "EllipsisType", not "int" [assert-type]
enums_member_values.py:88: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
enums_member_values.py:99: error: Expression is of type "EllipsisType", not "int" [assert-type]
"""
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]']
"""
Loading

0 comments on commit 684a6d2

Please sign in to comment.