Skip to content

Commit 663adb8

Browse files
committed
Accept reversed dataclass field-order warning
Extend PyTypingConformanceTest to allow the alternative diagnostic emitted when a dataclass field with a default precedes a field without a default. Both messages represent the same semantic error but differ in field-order phrasing.
1 parent b40321c commit 663adb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

conformance/tests/dataclasses_usage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ def __call__(
5757
# > single class, or as a result of class inheritance.
5858
@dataclass # E[DC1]
5959
class DC1:
60-
a: int = 0
60+
a: int = 0 # E[DC1]: field with default should follow a field with no default.
6161
b: int # E[DC1]: field with no default cannot follow field with default.
6262

6363

6464
@dataclass # E[DC2]
6565
class DC2:
66-
a: int = field(default=1)
66+
a: int = field(default=1) # E[DC2]: field with default should follow a field with no default.
6767
b: int # E[DC2]: field with no default cannot follow field with default.
6868

6969

7070
@dataclass # E[DC3]
7171
class DC3:
72-
a: InitVar[int] = 0
72+
a: InitVar[int] = 0 # E[DC3]: field with default should follow a field with no default.
7373
b: int # E[DC3]: field with no default cannot follow field with default.
7474

7575

0 commit comments

Comments
 (0)