Closed
Description
Bug Report
stubtest complains about missing __match_args__
if the dataclass has no fields
To Reproduce
Consider this python file:
from dataclasses import dataclass
from typing import ClassVar
@dataclass
class Good:
x: ClassVar[bool]
y: int = 0
@dataclass
class Bad:
x: ClassVar[bool]
and the corresponding stub file
from dataclasses import dataclass
from typing import ClassVar
@dataclass
class Good:
x: ClassVar[bool]
y: int = ...
@dataclass
class Bad:
x: ClassVar[bool]
Expected Behavior
Success: no issues found in 1 module
Actual Behavior
error: t.Bad.__match_args__ is not present in stub
Stub: in file /tmp/st-bug/t.pyi
MISSING
Runtime:
()
Found 1 error (checked 1 module)
Your Environment
- Mypy version used: mypy 1.4.1 (compiled: yes)
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini
(and other config files): N/A - Python version used: 3.10.6