-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtopic-dataclassestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
from dataclasses import dataclass
from unittest.mock import create_autospec
@dataclass
class Description:
name: str
mock = create_autospec(Description, instance=True)
print(isinstance(mock, Description))
# 3.13.3
True
# 3.14.0b2
False
Furthermore the resulting mock doesn't have attributes present on a dataclass instance, like __annotations__
, __class__
, __dataclass_fields__
, __dataclass_params__
.
print(dir(mock))
print(dir(Description("Hello World"))
Likely related to #124429. /CC @sobolevn
CPython versions tested on:
3.14
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtopic-dataclassestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error