We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ceef876 commit 63edf49Copy full SHA for 63edf49
test-data/unit/check-dataclasses.test
@@ -2623,3 +2623,19 @@ class User:
2623
2624
User("Foo", id=0)
2625
[builtins fixtures/tuple.pyi]
2626
+
2627
+[case testDataclassKwOnlyArgsDefaultAllowedNonLast]
2628
+from dataclasses import dataclass, field
2629
2630
+@dataclass
2631
+class User:
2632
+ id: int = field(kw_only=True, default=0)
2633
+ name: str
2634
2635
+User() # E: Missing positional argument "name" in call to "User"
2636
+User("")
2637
+User(0) # E: Argument 1 to "User" has incompatible type "int"; expected "str"
2638
+User("", 0) # E: Too many positional arguments for "User"
2639
+User("", id=0)
2640
+User("", name="") # E: "User" gets multiple values for keyword argument "name"
2641
+[builtins fixtures/tuple.pyi]
0 commit comments