diff --git a/conformance/results/mypy/dataclasses_usage.toml b/conformance/results/mypy/dataclasses_usage.toml index c458ce201..dc4a82db4 100644 --- a/conformance/results/mypy/dataclasses_usage.toml +++ b/conformance/results/mypy/dataclasses_usage.toml @@ -1,4 +1,7 @@ conformant = "Pass" +notes = """ +Does not detect unannotated usage of `dataclasses.field()`. +""" output = """ dataclasses_usage.py:36: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass [misc] dataclasses_usage.py:51: error: Missing positional argument "unit_price" in call to "InventoryItem" [call-arg] @@ -13,8 +16,7 @@ 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 = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 228: Expected 1 errors """ ignore_errors = ["Accessing \"__init__\" on an instance is unsound"] diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index da96566e1..773655198 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.9.0" -test_duration = 1.5 +test_duration = 2.2 diff --git a/conformance/results/pyre/dataclasses_usage.toml b/conformance/results/pyre/dataclasses_usage.toml index 998c75cb6..b8814ad43 100644 --- a/conformance/results/pyre/dataclasses_usage.toml +++ b/conformance/results/pyre/dataclasses_usage.toml @@ -20,10 +20,9 @@ dataclasses_usage.py:205:0 Incompatible variable type [9]: v7 is declared to hav """ conformance_automated = "Fail" errors_diff = """ -Line 62: Expected 1 errors -Line 68: Expected 1 errors -Line 74: Expected 1 errors -Line 228: Expected 1 errors +Lines 59, 62: Expected error (tag 'DC1') +Lines 65, 68: Expected error (tag 'DC2') +Lines 71, 74: Expected error (tag 'DC3') Line 73: Unexpected errors ['dataclasses_usage.py:73:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC3` has type `InitVar[int]` but is used as type `int`.'] Line 116: Unexpected errors ['dataclasses_usage.py:116:0 Uninitialized attribute [13]: Attribute `y` is declared in class `DC8` to have type `int` but is never initialized.'] Line 172: Unexpected errors ['dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x` is declared in class `DC13` to have type `int` but is never initialized.', 'dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x_squared` is declared in class `DC13` to have type `int` but is never initialized.'] diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 0bf606a1f..10179a617 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.19" -test_duration = 3.0 +test_duration = 3.7 diff --git a/conformance/results/pytype/dataclasses_usage.toml b/conformance/results/pytype/dataclasses_usage.toml index b63b1cecb..7b827381c 100644 --- a/conformance/results/pytype/dataclasses_usage.toml +++ b/conformance/results/pytype/dataclasses_usage.toml @@ -10,19 +10,8 @@ File "dataclasses_usage.py", line 84, in : Function DC4.__init__ expects File "dataclasses_usage.py", line 89, in DC5: Type annotation for a does not match type of assignment [annotation-type-mismatch] File "dataclasses_usage.py", line 127, in : Function DC7.__init__ expects 2 arg(s), got 3 [wrong-arg-count] File "dataclasses_usage.py", line 130, in : Missing parameter 'y' in call to function DC8.__init__ [missing-parameter] -File "dataclasses_usage.py", line 152, in __init__: Type annotation for x_squared does not match type of assignment [annotation-type-mismatch] -File "dataclasses_usage.py", line 165, in __init__: Type annotation for x_squared does not match type of assignment [annotation-type-mismatch] File "dataclasses_usage.py", line 179, in : Function DC13.__init__ expects 1 arg(s), got 2 [wrong-arg-count] """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 62: Expected 1 errors -Line 68: Expected 1 errors -Line 74: Expected 1 errors -Line 228: Expected 1 errors -Line 59: Unexpected errors ['File "dataclasses_usage.py", line 59, in : In method __init__, non-default argument b follows default argument [invalid-function-definition]'] -Line 65: Unexpected errors ['File "dataclasses_usage.py", line 65, in : In method __init__, non-default argument b follows default argument [invalid-function-definition]'] -Line 71: Unexpected errors ['File "dataclasses_usage.py", line 71, in : In method __init__, non-default argument b follows default argument [invalid-function-definition]'] -Line 152: Unexpected errors ['File "dataclasses_usage.py", line 152, in __init__: Type annotation for x_squared does not match type of assignment [annotation-type-mismatch]'] -Line 165: Unexpected errors ['File "dataclasses_usage.py", line 165, in __init__: Type annotation for x_squared does not match type of assignment [annotation-type-mismatch]'] """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 224dd6a68..cb7801271 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.03.19" -test_duration = 44.6 +test_duration = 44.2 diff --git a/conformance/results/results.html b/conformance/results/results.html index 10427f376..9eaa2a212 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

- + diff --git a/conformance/tests/dataclasses_usage.py b/conformance/tests/dataclasses_usage.py index 62def5032..05c4d79ec 100644 --- a/conformance/tests/dataclasses_usage.py +++ b/conformance/tests/dataclasses_usage.py @@ -56,22 +56,22 @@ def __call__( # > TypeError will be raised if a field without a default value follows a # > field with a default value. This is true either when this occurs in a # > single class, or as a result of class inheritance. -@dataclass +@dataclass # E[DC1] class DC1: a: int = 0 - b: int # E: field with no default cannot follow field with default. + b: int # E[DC1]: field with no default cannot follow field with default. -@dataclass +@dataclass # E[DC2] class DC2: a: int = field(default=1) - b: int # E: field with no default cannot follow field with default. + b: int # E[DC2]: field with no default cannot follow field with default. -@dataclass +@dataclass # E[DC3] class DC3: a: InitVar[int] = 0 - b: int # E: field with no default cannot follow field with default. + b: int # E[DC3]: field with no default cannot follow field with default. @dataclass @@ -149,7 +149,7 @@ class DC11: def __init__(self, x: int): self.x = x - self.x_squared = x**2 + self.x_squared = x * x DC11(3) @@ -162,7 +162,7 @@ class DC12: def __init__(self, x: int): self.x = x - self.x_squared = x**2 + self.x_squared = x * x DC12(3) @@ -223,6 +223,6 @@ class DC17(DC16[str]): @dataclass class DC18: x: int = field() - # This should generate an error because an unannotated field + # This may generate a type checker error because an unannotated field # will result in a runtime exception. - y = field() # E + y = field() # E?
 
mypy 1.9.0
-
1.5sec
+
2.2sec
pyright 1.1.357
1.6sec
pyre 0.9.19
-
3.0sec
+
3.7sec
pytype 2024.03.19
-
44.6sec
+
44.2sec
@@ -703,7 +703,7 @@

Python Type System Conformance Test Results

Unsupported

Does not understand @dataclass_transform.

     dataclasses_usagePass
Pass*

Does not detect unannotated usage of `dataclasses.field()`.

Pass
Partial

Does not report error when field with no default follows field with default.

Incorrectly reports error with InitVar that has default value.

Pass