Files
Petrandintellij-monorepo-bot 5486d93839 PY-76841 Conformance test failure: dataclasses_postinit.py
__post_init__ parameters have to match InitVars type not name

GitOrigin-RevId: 0e1e4a9c3a50eee84cd724b5a3f8c5e894e90bdd
2024-12-11 20:51:44 +00:00

19 lines
525 B
Python

import dataclasses
@dataclasses.dataclass
class A:
a: int
b: dataclasses.InitVar[str]
c: dataclasses.InitVar[bytes]
def __post_init__<error descr="'__post_init__' should take all init-only variables in the same order as they are defined">(self)</error>:
pass
@dataclasses.dataclass
class B:
a: int
b: dataclasses.InitVar[str]
c: dataclasses.InitVar[bytes]
def __post_init__(self, c: <warning descr="Expected type 'str', got 'bytes' instead">bytes</warning>, b: bytes):
pass