You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed a bug in the conformance test for ClassVar qualifier (#1742)
Fixed a bug in the conformance test for `ClassVar` qualifier. The test was not importing `Final`, so it was not really testing what it intended.
Also added some additional comments to the recently-added test for `dataclasses_final` for consistency with other tests.
Copy file name to clipboardExpand all lines: conformance/results/mypy/dataclasses_final.toml
+16-12Lines changed: 16 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,22 @@ Doesn't support Final nested inside ClassVar.
5
5
"""
6
6
conformance_automated = "Fail"
7
7
errors_diff = """
8
-
Line 16: Expected 1 errors
9
-
Line 6: Unexpected errors ['dataclasses_final.py:6: error: Final name must be initialized with a value [misc]']
10
-
Line 8: Unexpected errors ['dataclasses_final.py:8: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]']
11
-
Line 13: Unexpected errors ['dataclasses_final.py:13: error: Expression is of type "Any", not "int" [assert-type]']
8
+
Line 27: Expected 1 errors
9
+
Line 38: Expected 1 errors
10
+
Line 41: Expected 1 errors
11
+
Line 16: Unexpected errors ['dataclasses_final.py:16: error: Final name must be initialized with a value [misc]']
12
+
Line 18: Unexpected errors ['dataclasses_final.py:18: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]']
13
+
Line 24: Unexpected errors ['dataclasses_final.py:24: error: Expression is of type "Any", not "int" [assert-type]']
14
+
Line 37: Unexpected errors ['dataclasses_final.py:37: error: Cannot access final instance attribute "final_no_default" on class object [misc]', 'dataclasses_final.py:37: error: Cannot assign to final attribute "final_no_default" [misc]']
15
+
Line 40: Unexpected errors ['dataclasses_final.py:40: error: Cannot assign to final attribute "final_with_default" [misc]']
12
16
"""
13
17
output = """
14
-
dataclasses_final.py:6: error: Final name must be initialized with a value [misc]
15
-
dataclasses_final.py:8: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]
16
-
dataclasses_final.py:13: error: Expression is of type "Any", not "int" [assert-type]
17
-
dataclasses_final.py:24: error: Cannot assign to final attribute "final_no_default" [misc]
18
-
dataclasses_final.py:25: error: Cannot assign to final attribute "final_with_default" [misc]
19
-
dataclasses_final.py:26: error: Cannot access final instance attribute "final_no_default" on class object [misc]
20
-
dataclasses_final.py:26: error: Cannot assign to final attribute "final_no_default" [misc]
21
-
dataclasses_final.py:27: error: Cannot assign to final attribute "final_with_default" [misc]
18
+
dataclasses_final.py:16: error: Final name must be initialized with a value [misc]
19
+
dataclasses_final.py:18: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type]
20
+
dataclasses_final.py:24: error: Expression is of type "Any", not "int" [assert-type]
21
+
dataclasses_final.py:35: error: Cannot assign to final attribute "final_no_default" [misc]
22
+
dataclasses_final.py:36: error: Cannot assign to final attribute "final_with_default" [misc]
23
+
dataclasses_final.py:37: error: Cannot access final instance attribute "final_no_default" on class object [misc]
24
+
dataclasses_final.py:37: error: Cannot assign to final attribute "final_no_default" [misc]
25
+
dataclasses_final.py:40: error: Cannot assign to final attribute "final_with_default" [misc]
Copy file name to clipboardExpand all lines: conformance/results/pyre/classes_classvar.toml
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -11,35 +11,35 @@ Does not reject use of ClassVar in type alias definition.
11
11
Does not infer type from initialization for bare ClassVar.
12
12
"""
13
13
output = """
14
-
classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad1` is declared in class `ClassA` to have type `typing.Any` but is never initialized.
15
-
classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad4` is declared in class `ClassA` to have type `Variable[T]` but is never initialized.
16
-
classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad5` is declared in class `ClassA` to have type `typing.List[Variable[T]]` but is never initialized.
17
-
classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad6` is declared in class `ClassA` to have type `typing.Callable[classes_classvar.P, typing.Any]` but is never initialized.
18
-
classes_classvar.py:36:10 Invalid type parameters [24]: Generic type `CV` expects 1 type parameter, received 2.
19
-
classes_classvar.py:37:10 Invalid type [31]: Expression `typing.ClassVar[3]` is not a valid type.
20
-
classes_classvar.py:38:13 Unbound name [10]: Name `var` is used but not defined in the current scope.
21
-
classes_classvar.py:50:4 Incompatible attribute type [8]: Attribute `bad8` declared in class `ClassA` has type `List[str]` but is used as type `Dict[Variable[_KT], Variable[_VT]]`.
22
-
classes_classvar.py:52:10 Unbound name [10]: Name `Final` is used but not defined in the current scope.
23
-
classes_classvar.py:63:8 Undefined attribute [16]: `ClassA` has no attribute `xx`.
24
-
classes_classvar.py:66:8 Incompatible return type [7]: Expected `CV[int]` but got `int`.
25
-
classes_classvar.py:76:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `float` but got `typing.Any`.
26
-
classes_classvar.py:79:0 Uninitialized attribute [13]: Attribute `damage` is declared in class `BasicStarship` to have type `int` but is never initialized.
27
-
classes_classvar.py:100:0 Invalid assignment [41]: Assigning to class variable through instance, did you mean to assign to `Starship.stats` instead?
28
-
classes_classvar.py:129:0 Incompatible variable type [9]: a is declared to have type `ProtoA` but is used as type `ProtoAImpl`.
14
+
classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad1` is declared in class `ClassA` to have type `typing.Any` but is never initialized.
15
+
classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad4` is declared in class `ClassA` to have type `Variable[T]` but is never initialized.
16
+
classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad5` is declared in class `ClassA` to have type `typing.List[Variable[T]]` but is never initialized.
17
+
classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad6` is declared in class `ClassA` to have type `typing.Callable[classes_classvar.P, typing.Any]` but is never initialized.
18
+
classes_classvar.py:37:10 Invalid type parameters [24]: Generic type `CV` expects 1 type parameter, received 2.
19
+
classes_classvar.py:38:10 Invalid type [31]: Expression `typing.ClassVar[3]` is not a valid type.
20
+
classes_classvar.py:39:13 Unbound name [10]: Name `var` is used but not defined in the current scope.
21
+
classes_classvar.py:51:4 Incompatible attribute type [8]: Attribute `bad8` declared in class `ClassA` has type `List[str]` but is used as type `Dict[Variable[_KT], Variable[_VT]]`.
22
+
classes_classvar.py:64:8 Undefined attribute [16]: `ClassA` has no attribute `xx`.
23
+
classes_classvar.py:67:8 Incompatible return type [7]: Expected `CV[int]` but got `int`.
24
+
classes_classvar.py:77:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `float` but got `typing.Any`.
25
+
classes_classvar.py:80:0 Uninitialized attribute [13]: Attribute `damage` is declared in class `BasicStarship` to have type `int` but is never initialized.
26
+
classes_classvar.py:101:0 Invalid assignment [41]: Assigning to class variable through instance, did you mean to assign to `Starship.stats` instead?
27
+
classes_classvar.py:130:0 Incompatible variable type [9]: a is declared to have type `ProtoA` but is used as type `ProtoAImpl`.
29
28
"""
30
29
conformance_automated = "Fail"
31
30
errors_diff = """
32
-
Line 43: Expected 1 errors
33
31
Line 44: Expected 1 errors
34
32
Line 45: Expected 1 errors
33
+
Line 46: Expected 1 errors
35
34
Line 53: Expected 1 errors
36
-
Line 61: Expected 1 errors
35
+
Line 54: Expected 1 errors
37
36
Line 62: Expected 1 errors
38
-
Line 65: Expected 1 errors
39
-
Line 69: Expected 1 errors
37
+
Line 63: Expected 1 errors
38
+
Line 66: Expected 1 errors
40
39
Line 70: Expected 1 errors
41
-
Line 33: Unexpected errors ['classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad1` is declared in class `ClassA` to have type `typing.Any` but is never initialized.', 'classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad4` is declared in class `ClassA` to have type `Variable[T]` but is never initialized.', 'classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad5` is declared in class `ClassA` to have type `typing.List[Variable[T]]` but is never initialized.', 'classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad6` is declared in class `ClassA` to have type `typing.Callable[classes_classvar.P, typing.Any]` but is never initialized.']
42
-
Line 66: Unexpected errors ['classes_classvar.py:66:8 Incompatible return type [7]: Expected `CV[int]` but got `int`.']
43
-
Line 76: Unexpected errors ['classes_classvar.py:76:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `float` but got `typing.Any`.']
44
-
Line 79: Unexpected errors ['classes_classvar.py:79:0 Uninitialized attribute [13]: Attribute `damage` is declared in class `BasicStarship` to have type `int` but is never initialized.']
40
+
Line 71: Expected 1 errors
41
+
Line 34: Unexpected errors ['classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad1` is declared in class `ClassA` to have type `typing.Any` but is never initialized.', 'classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad4` is declared in class `ClassA` to have type `Variable[T]` but is never initialized.', 'classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad5` is declared in class `ClassA` to have type `typing.List[Variable[T]]` but is never initialized.', 'classes_classvar.py:34:0 Uninitialized attribute [13]: Attribute `bad6` is declared in class `ClassA` to have type `typing.Callable[classes_classvar.P, typing.Any]` but is never initialized.']
42
+
Line 67: Unexpected errors ['classes_classvar.py:67:8 Incompatible return type [7]: Expected `CV[int]` but got `int`.']
43
+
Line 77: Unexpected errors ['classes_classvar.py:77:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `float` but got `typing.Any`.']
44
+
Line 80: Unexpected errors ['classes_classvar.py:80:0 Uninitialized attribute [13]: Attribute `damage` is declared in class `BasicStarship` to have type `int` but is never initialized.']
Copy file name to clipboardExpand all lines: conformance/results/pyre/dataclasses_final.toml
+14-10Lines changed: 14 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,20 @@ Mis-handles Final nested inside ClassVar.
4
4
"""
5
5
conformance_automated = "Fail"
6
6
errors_diff = """
7
-
Line 8: Unexpected errors ['dataclasses_final.py:8:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.', 'dataclasses_final.py:8:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.']
8
-
Line 13: Unexpected errors ['dataclasses_final.py:13:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.']
7
+
Line 38: Expected 1 errors
8
+
Line 41: Expected 1 errors
9
+
Line 18: Unexpected errors ['dataclasses_final.py:18:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.', 'dataclasses_final.py:18:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.']
10
+
Line 24: Unexpected errors ['dataclasses_final.py:24:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.']
11
+
Line 37: Unexpected errors ['dataclasses_final.py:37:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_no_default`.']
12
+
Line 40: Unexpected errors ['dataclasses_final.py:40:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_with_default`.']
9
13
"""
10
14
output = """
11
-
dataclasses_final.py:8:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
12
-
dataclasses_final.py:8:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.
13
-
dataclasses_final.py:13:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.
14
-
dataclasses_final.py:16:0 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
15
-
dataclasses_final.py:24:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_no_default`.
16
-
dataclasses_final.py:25:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_with_default`.
17
-
dataclasses_final.py:26:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_no_default`.
18
-
dataclasses_final.py:27:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_with_default`.
15
+
dataclasses_final.py:18:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
16
+
dataclasses_final.py:18:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.
17
+
dataclasses_final.py:24:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.
18
+
dataclasses_final.py:27:0 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
19
+
dataclasses_final.py:35:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_no_default`.
20
+
dataclasses_final.py:36:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_with_default`.
21
+
dataclasses_final.py:37:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_no_default`.
22
+
dataclasses_final.py:40:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_with_default`.
0 commit comments