-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-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
FalseFurthermore 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 fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-dataclassestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error