Skip to content

Commit 284dc36

Browse files
Conformance tests: Fix automated scoring for pyright dataclasses tests (#1699)
Part of #1692
1 parent 5166fd0 commit 284dc36

19 files changed

+58
-83
lines changed

conformance/results/mypy/dataclasses_slots.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ notes = """
33
Does not reject write to instance variable that is not defined in __slots__.
44
"""
55
output = """
6-
dataclasses_slots.py:12: error: "DC1" both defines "__slots__" and is used with "slots=True" [misc]
7-
dataclasses_slots.py:67: error: "type[DC6]" has no attribute "__slots__" [attr-defined]
8-
dataclasses_slots.py:70: error: "DC6" has no attribute "__slots__" [attr-defined]
6+
dataclasses_slots.py:11: error: "DC1" both defines "__slots__" and is used with "slots=True" [misc]
7+
dataclasses_slots.py:66: error: "type[DC6]" has no attribute "__slots__" [attr-defined]
8+
dataclasses_slots.py:69: error: "DC6" has no attribute "__slots__" [attr-defined]
99
"""
1010
conformance_automated = "Fail"
1111
errors_diff = """
12-
Line 12: Unexpected errors ['dataclasses_slots.py:12: error: "DC1" both defines "__slots__" and is used with "slots=True" [misc]']
13-
Line 67: Unexpected errors ['dataclasses_slots.py:67: error: "type[DC6]" has no attribute "__slots__" [attr-defined]']
14-
Line 70: Unexpected errors ['dataclasses_slots.py:70: error: "DC6" has no attribute "__slots__" [attr-defined]']
12+
Line 25: Expected 1 errors
13+
Line 38: Expected 1 errors
1514
"""

conformance/results/mypy/dataclasses_transform_field.toml

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ dataclasses_transform_field.py:77: error: Missing named argument "id" for "Custo
1010
"""
1111
conformance_automated = "Fail"
1212
errors_diff = """
13-
Line 64: Unexpected errors ['dataclasses_transform_field.py:64: error: Unexpected keyword argument "id" for "CustomerModel1" [call-arg]']
14-
Line 75: Unexpected errors ['dataclasses_transform_field.py:75: error: Too many positional arguments for "CustomerModel2" [misc]', 'dataclasses_transform_field.py:75: error: Missing named argument "name" for "CustomerModel2" [call-arg]']
1513
Line 77: Unexpected errors ['dataclasses_transform_field.py:77: error: Missing named argument "id" for "CustomerModel2" [call-arg]']
1614
"""

conformance/results/mypy/dataclasses_transform_func.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ dataclasses_transform_func.py:97: error: Property "id" defined in "Customer3" is
1313
"""
1414
conformance_automated = "Fail"
1515
errors_diff = """
16+
Line 61: Expected 1 errors
1617
Line 53: Unexpected errors ['dataclasses_transform_func.py:53: error: Too many positional arguments for "Customer1" [misc]']
17-
Line 57: Unexpected errors ['dataclasses_transform_func.py:57: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]']
18-
Line 65: Unexpected errors ['dataclasses_transform_func.py:65: error: Unexpected keyword argument "salary" for "Customer1" [call-arg]']
19-
Line 71: Unexpected errors ['dataclasses_transform_func.py:71: error: Too many positional arguments for "Customer2" [misc]']
20-
Line 90: Unexpected errors ['dataclasses_transform_func.py:90: error: Cannot inherit non-frozen dataclass from a frozen one [misc]']
21-
Line 97: Unexpected errors ['dataclasses_transform_func.py:97: error: Property "id" defined in "Customer3" is read-only [misc]']
2218
"""

conformance/results/pyre/dataclasses_frozen.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ dataclasses_frozen.py:17:0 Invalid assignment [41]: Cannot reassign final attrib
99
"""
1010
conformance_automated = "Fail"
1111
errors_diff = """
12-
Line 23: Expected 1 errors
13-
Line 33: Expected 1 errors
12+
Lines 22, 23: Expected error (tag 'DC2')
13+
Lines 32, 33: Expected error (tag 'DC4')
1414
"""

conformance/results/pyre/dataclasses_slots.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ Does not reject write to instance variable that is not defined in __slots__.
55
Does not reject access to `__slots__` from dataclass instance when `slots=False`.
66
"""
77
output = """
8-
dataclasses_slots.py:67:0 Undefined attribute [16]: `DC6` has no attribute `__slots__`.
8+
dataclasses_slots.py:66:0 Undefined attribute [16]: `DC6` has no attribute `__slots__`.
99
"""
1010
conformance_automated = "Fail"
1111
errors_diff = """
12-
Line 67: Unexpected errors ['dataclasses_slots.py:67:0 Undefined attribute [16]: `DC6` has no attribute `__slots__`.']
12+
Line 25: Expected 1 errors
13+
Line 38: Expected 1 errors
14+
Line 69: Expected 1 errors
15+
Lines 10, 11: Expected error (tag 'DC1')
1316
"""

conformance/results/pyre/dataclasses_transform_field.toml

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ conformance_automated = "Fail"
1313
errors_diff = """
1414
Line 49: Unexpected errors ["dataclasses_transform_field.py:49:42 Invalid type variable [34]: The type variable `Variable[T]` isn't present in the function's parameters."]
1515
Line 60: Unexpected errors ['dataclasses_transform_field.py:60:0 Unexpected keyword [28]: Unexpected keyword argument `name` to call `object.__init__`.']
16-
Line 64: Unexpected errors ['dataclasses_transform_field.py:64:0 Unexpected keyword [28]: Unexpected keyword argument `id` to call `object.__init__`.']
17-
Line 75: Unexpected errors ['dataclasses_transform_field.py:75:0 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided.']
1816
Line 77: Unexpected errors ['dataclasses_transform_field.py:77:0 Unexpected keyword [28]: Unexpected keyword argument `name` to call `object.__init__`.']
1917
"""

conformance/results/pyre/dataclasses_transform_func.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dataclasses_transform_func.py:94:7 Unexpected keyword [28]: Unexpected keyword a
2626
"""
2727
conformance_automated = "Fail"
2828
errors_diff = """
29+
Line 97: Expected 1 errors
2930
Line 20: Unexpected errors ['dataclasses_transform_func.py:20:0 Incompatible overload [43]: The implementation of `create_model` does not accept all possible arguments of overload defined on line `20`.']
3031
Line 25: Unexpected errors ["dataclasses_transform_func.py:25:5 Invalid type variable [34]: The type variable `Variable[T]` isn't present in the function's parameters."]
3132
Line 29: Unexpected errors ['dataclasses_transform_func.py:29:0 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).']
@@ -34,13 +35,8 @@ Line 40: Unexpected errors ['dataclasses_transform_func.py:40:0 Uninitialized at
3435
Line 46: Unexpected errors ['dataclasses_transform_func.py:46:0 Uninitialized attribute [13]: Attribute `salary` is declared in class `Customer2Subclass` to have type `float` but is never initialized.']
3536
Line 50: Unexpected errors ['dataclasses_transform_func.py:50:7 Unexpected keyword [28]: Unexpected keyword argument `id` to call `object.__init__`.']
3637
Line 53: Unexpected errors ['dataclasses_transform_func.py:53:7 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 2 were provided.']
37-
Line 57: Unexpected errors ['dataclasses_transform_func.py:57:0 Incompatible attribute type [8]: Attribute `name` declared in class `Customer1` has type `str` but is used as type `int`.']
38-
Line 61: Unexpected errors ['dataclasses_transform_func.py:61:5 Unsupported operand [58]: `<` is not supported for operand types `Customer1` and `Customer1`.']
39-
Line 65: Unexpected errors ['dataclasses_transform_func.py:65:7 Unexpected keyword [28]: Unexpected keyword argument `id` to call `object.__init__`.']
4038
Line 67: Unexpected errors ['dataclasses_transform_func.py:67:7 Unexpected keyword [28]: Unexpected keyword argument `id` to call `object.__init__`.']
41-
Line 71: Unexpected errors ['dataclasses_transform_func.py:71:7 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 2 were provided.']
4239
Line 73: Unexpected errors ['dataclasses_transform_func.py:73:5 Unsupported operand [58]: `<` is not supported for operand types `Customer2` and `Customer2`.']
4340
Line 82: Unexpected errors ['dataclasses_transform_func.py:82:0 Uninitialized attribute [13]: Attribute `id` is declared in class `Customer3` to have type `int` but is never initialized.', 'dataclasses_transform_func.py:82:0 Uninitialized attribute [13]: Attribute `name` is declared in class `Customer3` to have type `str` but is never initialized.']
44-
Line 90: Unexpected errors ['dataclasses_transform_func.py:90:0 Uninitialized attribute [13]: Attribute `age` is declared in class `Customer3Subclass` to have type `int` but is never initialized.']
4541
Line 94: Unexpected errors ['dataclasses_transform_func.py:94:7 Unexpected keyword [28]: Unexpected keyword argument `id` to call `object.__init__`.']
4642
"""

conformance/results/pyright/dataclasses_frozen.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ dataclasses_frozen.py:17:5 - error: Cannot assign member "b" for type "DC1"
99
dataclasses_frozen.py:22:1 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues)
1010
dataclasses_frozen.py:32:12 - error: A frozen class cannot inherit from a class that is not frozen (reportGeneralTypeIssues)
1111
"""
12-
conformance_automated = "Fail"
12+
conformance_automated = "Pass"
1313
errors_diff = """
14-
Line 23: Expected 1 errors
15-
Line 33: Expected 1 errors
16-
Line 22: Unexpected errors ['dataclasses_frozen.py:22:1 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues)']
17-
Line 32: Unexpected errors ['dataclasses_frozen.py:32:12 - error: A frozen class cannot inherit from a class that is not frozen (reportGeneralTypeIssues)']
1814
"""
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
conformant = "Pass"
22
output = """
3-
dataclasses_slots.py:11:12 - error: __slots__ is already defined in class (reportGeneralTypeIssues)
4-
dataclasses_slots.py:26:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)
5-
dataclasses_slots.py:39:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)
6-
dataclasses_slots.py:67:5 - error: Cannot access member "__slots__" for type "type[DC6]"
3+
dataclasses_slots.py:10:12 - error: __slots__ is already defined in class (reportGeneralTypeIssues)
4+
dataclasses_slots.py:25:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)
5+
dataclasses_slots.py:38:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)
6+
dataclasses_slots.py:66:5 - error: Cannot access member "__slots__" for type "type[DC6]"
77
  Member "__slots__" is unknown (reportAttributeAccessIssue)
8-
dataclasses_slots.py:70:8 - error: Cannot access member "__slots__" for type "DC6"
8+
dataclasses_slots.py:69:8 - error: Cannot access member "__slots__" for type "DC6"
99
  Member "__slots__" is unknown (reportAttributeAccessIssue)
1010
"""
11-
conformance_automated = "Fail"
11+
conformance_automated = "Pass"
1212
errors_diff = """
13-
Line 11: Unexpected errors ['dataclasses_slots.py:11:12 - error: __slots__ is already defined in class (reportGeneralTypeIssues)']
14-
Line 26: Unexpected errors ['dataclasses_slots.py:26:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)']
15-
Line 39: Unexpected errors ['dataclasses_slots.py:39:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues)']
16-
Line 67: Unexpected errors ['dataclasses_slots.py:67:5 - error: Cannot access member "__slots__" for type "type[DC6]"']
17-
Line 70: Unexpected errors ['dataclasses_slots.py:70:8 - error: Cannot access member "__slots__" for type "DC6"']
1813
"""

conformance/results/pyright/dataclasses_transform_field.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ output = """
33
dataclasses_transform_field.py:64:16 - error: No parameter named "id" (reportCallIssue)
44
dataclasses_transform_field.py:75:16 - error: Expected 0 positional arguments (reportCallIssue)
55
"""
6-
conformance_automated = "Fail"
6+
conformance_automated = "Pass"
77
errors_diff = """
8-
Line 64: Unexpected errors ['dataclasses_transform_field.py:64:16 - error: No parameter named "id" (reportCallIssue)']
9-
Line 75: Unexpected errors ['dataclasses_transform_field.py:75:16 - error: Expected 0 positional arguments (reportCallIssue)']
108
"""

conformance/results/pyright/dataclasses_transform_func.toml

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ dataclasses_transform_func.py:97:6 - error: Cannot assign member "id" for type "
1010
  "Customer3" is frozen
1111
    Member "__set__" is unknown (reportAttributeAccessIssue)
1212
"""
13-
conformance_automated = "Fail"
13+
conformance_automated = "Pass"
1414
errors_diff = """
15-
Line 57: Unexpected errors ['dataclasses_transform_func.py:57:13 - error: Cannot assign member "name" for type "Customer1"']
16-
Line 61: Unexpected errors ['dataclasses_transform_func.py:61:6 - error: Operator "<" not supported for types "Customer1" and "Customer1" (reportOperatorIssue)']
17-
Line 65: Unexpected errors ['dataclasses_transform_func.py:65:36 - error: No parameter named "salary" (reportCallIssue)']
18-
Line 71: Unexpected errors ['dataclasses_transform_func.py:71:18 - error: Expected 0 positional arguments (reportCallIssue)']
19-
Line 89: Unexpected errors ['dataclasses_transform_func.py:89:1 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues)']
20-
Line 97: Unexpected errors ['dataclasses_transform_func.py:97:6 - error: Cannot assign member "id" for type "Customer3"']
2115
"""

conformance/results/pytype/dataclasses_frozen.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ conformance_automated = "Fail"
1111
errors_diff = """
1212
Line 16: Expected 1 errors
1313
Line 17: Expected 1 errors
14-
Line 23: Expected 1 errors
15-
Line 33: Expected 1 errors
14+
Lines 22, 23: Expected error (tag 'DC2')
15+
Lines 32, 33: Expected error (tag 'DC4')
1616
"""

conformance/results/pytype/dataclasses_slots.toml

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ Does not reject write to instance variable that is not defined in __slots__.
55
Incorrectly reports error when accessing `__slots__` when `slots=True`.
66
"""
77
output = """
8-
File "dataclasses_slots.py", line 57, in <module>: No attribute '__slots__' on Type[DC5] [attribute-error]
9-
File "dataclasses_slots.py", line 58, in <module>: No attribute '__slots__' on DC5 [attribute-error]
10-
File "dataclasses_slots.py", line 67, in <module>: No attribute '__slots__' on Type[DC6] [attribute-error]
11-
File "dataclasses_slots.py", line 70, in <module>: No attribute '__slots__' on DC6 [attribute-error]
8+
File "dataclasses_slots.py", line 56, in <module>: No attribute '__slots__' on Type[DC5] [attribute-error]
9+
File "dataclasses_slots.py", line 57, in <module>: No attribute '__slots__' on DC5 [attribute-error]
10+
File "dataclasses_slots.py", line 66, in <module>: No attribute '__slots__' on Type[DC6] [attribute-error]
11+
File "dataclasses_slots.py", line 69, in <module>: No attribute '__slots__' on DC6 [attribute-error]
1212
"""
1313
conformance_automated = "Fail"
1414
errors_diff = """
15-
Line 57: Unexpected errors ['File "dataclasses_slots.py", line 57, in <module>: No attribute \\'__slots__\\' on Type[DC5] [attribute-error]']
16-
Line 58: Unexpected errors ['File "dataclasses_slots.py", line 58, in <module>: No attribute \\'__slots__\\' on DC5 [attribute-error]']
17-
Line 67: Unexpected errors ['File "dataclasses_slots.py", line 67, in <module>: No attribute \\'__slots__\\' on Type[DC6] [attribute-error]']
18-
Line 70: Unexpected errors ['File "dataclasses_slots.py", line 70, in <module>: No attribute \\'__slots__\\' on DC6 [attribute-error]']
15+
Line 25: Expected 1 errors
16+
Line 38: Expected 1 errors
17+
Lines 10, 11: Expected error (tag 'DC1')
18+
Line 56: Unexpected errors ['File "dataclasses_slots.py", line 56, in <module>: No attribute \\'__slots__\\' on Type[DC5] [attribute-error]']
19+
Line 57: Unexpected errors ['File "dataclasses_slots.py", line 57, in <module>: No attribute \\'__slots__\\' on DC5 [attribute-error]']
1920
"""

conformance/results/pytype/dataclasses_transform_field.toml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ File "dataclasses_transform_field.py", line 50, in create_model: bad return type
88
"""
99
conformance_automated = "Fail"
1010
errors_diff = """
11+
Line 64: Expected 1 errors
12+
Line 75: Expected 1 errors
1113
Line 48: Unexpected errors ['File "dataclasses_transform_field.py", line 48, in <module>: Arguments to dataclass_transform not supported yet [not-supported-yet]']
1214
Line 50: Unexpected errors ['File "dataclasses_transform_field.py", line 50, in create_model: bad return type [bad-return-type]']
1315
"""

conformance/results/pytype/dataclasses_transform_func.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ File "dataclasses_transform_func.py", line 76, in <module>: Arguments to datacla
1919
"""
2020
conformance_automated = "Fail"
2121
errors_diff = """
22+
Line 61: Expected 1 errors
23+
Line 97: Expected 1 errors
24+
Lines 89, 90: Expected error (tag 'Customer3Subclass')
2225
Line 13: Unexpected errors ['File "dataclasses_transform_func.py", line 13, in <module>: Arguments to dataclass_transform not supported yet [not-supported-yet]']
2326
Line 19: Unexpected errors ['File "dataclasses_transform_func.py", line 19, in <module>: Arguments to dataclass_transform not supported yet [not-supported-yet]']
2427
Line 30: Unexpected errors ['File "dataclasses_transform_func.py", line 30, in create_model: bad return type [bad-return-type]', 'File "dataclasses_transform_func.py", line 30, in create_model: bad return type [bad-return-type]']
2528
Line 50: Unexpected errors ['File "dataclasses_transform_func.py", line 50, in <module>: Invalid keyword arguments (id, name) to function Customer1.__init__ [wrong-keyword-args]']
2629
Line 53: Unexpected errors ['File "dataclasses_transform_func.py", line 53, in <module>: Function Customer1.__init__ expects 1 arg(s), got 3 [wrong-arg-count]']
27-
Line 57: Unexpected errors ['File "dataclasses_transform_func.py", line 57, in <module>: Type annotation for name does not match type of assignment [annotation-type-mismatch]']
28-
Line 65: Unexpected errors ['File "dataclasses_transform_func.py", line 65, in <module>: Invalid keyword arguments (id, name, salary) to function Customer1.__init__ [wrong-keyword-args]']
2930
Line 67: Unexpected errors ['File "dataclasses_transform_func.py", line 67, in <module>: Invalid keyword arguments (id, name) to function Customer2.__init__ [wrong-keyword-args]']
30-
Line 71: Unexpected errors ['File "dataclasses_transform_func.py", line 71, in <module>: Function Customer2.__init__ expects 1 arg(s), got 3 [wrong-arg-count]']
3131
Line 76: Unexpected errors ['File "dataclasses_transform_func.py", line 76, in <module>: Arguments to dataclass_transform not supported yet [not-supported-yet]']
3232
"""

conformance/tests/dataclasses_frozen.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class DC1:
1919

2020
# This should generate an error because a non-frozen dataclass
2121
# cannot inherit from a frozen dataclass.
22-
@dataclass
23-
class DC2(DC1): # E
22+
@dataclass # E[DC2]
23+
class DC2(DC1): # E[DC2]
2424
pass
2525

2626
@dataclass
@@ -29,8 +29,8 @@ class DC3:
2929

3030
# This should generate an error because a frozen dataclass
3131
# cannot inherit from a non-frozen dataclass.
32-
@dataclass(frozen=True)
33-
class DC4(DC3): # E
32+
@dataclass(frozen=True) # E[DC4]
33+
class DC4(DC3): # E[DC4]
3434
pass
3535

3636

conformance/tests/dataclasses_slots.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
# Specification: https://docs.python.org/3/library/dataclasses.html#module-contents
66

77
from dataclasses import dataclass
8-
from typing import Iterable, assert_type
98

109
# This should generate an error because __slots__ is already defined.
11-
@dataclass(slots=True)
12-
class DC1:
10+
@dataclass(slots=True) # E[DC1]
11+
class DC1: # E[DC1]
1312
x: int
1413

1514
__slots__ = ()
@@ -23,7 +22,7 @@ def __init__(self):
2322
self.x = 3
2423

2524
# This should generate an error because "y" is not in slots.
26-
self.y = 3
25+
self.y = 3 # E
2726

2827

2928
@dataclass(slots=False)
@@ -36,7 +35,7 @@ def __init__(self):
3635
self.x = 3
3736

3837
# This should generate an error because "y" is not in slots.
39-
self.y = 3
38+
self.y = 3 # E
4039

4140

4241
@dataclass
@@ -64,7 +63,7 @@ class DC6:
6463

6564

6665
# This should generate an error because __slots__ is not defined.
67-
DC6.__slots__
66+
DC6.__slots__ # E
6867

6968
# This should generate an error because __slots__ is not defined.
70-
DC6(1).__slots__
69+
DC6(1).__slots__ # E

conformance/tests/dataclasses_transform_field.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CustomerModel1:
6161

6262
# This should generate an error because "id" is not
6363
# supposed to be part of the init function.
64-
CustomerModel1(id=1, name="hi")
64+
CustomerModel1(id=1, name="hi") # E
6565

6666

6767
@create_model()
@@ -72,6 +72,6 @@ class CustomerModel2:
7272

7373
# This should generate an error because kw_only is True
7474
# by default for field2.
75-
CustomerModel2(1)
75+
CustomerModel2(1) # E
7676

7777
CustomerModel2(name="Fred")

conformance/tests/dataclasses_transform_func.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ class Customer2Subclass(Customer2):
5454
c1_2.name = "Susan"
5555

5656
# This should generate an error because of a type mismatch.
57-
c1_2.name = 3
57+
c1_2.name = 3 # E
5858

5959
# This should generate an error because comparison methods are
6060
# not synthesized.
61-
v1 = c1_1 < c1_2
61+
v1 = c1_1 < c1_2 # E
6262

6363
# This should generate an error because salary is not
6464
# a defined field.
65-
c1_3 = Customer1(id=3, name="Sue", salary=40000)
65+
c1_3 = Customer1(id=3, name="Sue", salary=40000) # E
6666

6767
c2_1 = Customer2(id=0, name="John")
6868

6969
# This should generate an error because Customer2 supports
7070
# keyword-only parameters for its constructor.
71-
c2_2 = Customer2(0, "John")
71+
c2_2 = Customer2(0, "John") # E
7272

7373
v2 = c2_1 < c2_2
7474

@@ -86,12 +86,12 @@ class Customer3:
8686

8787
# This should generate an error because a non-frozen class
8888
# cannot inherit from a frozen class.
89-
@create_model
90-
class Customer3Subclass(Customer3):
89+
@create_model # E[Customer3Subclass]
90+
class Customer3Subclass(Customer3): # E[Customer3Subclass]
9191
age: int
9292

9393

9494
c3_1 = Customer3(id=2, name="hi")
9595

9696
# This should generate an error because Customer3 is frozen.
97-
c3_1.id = 4
97+
c3_1.id = 4 # E

0 commit comments

Comments
 (0)