Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

unittest.mock: Regression with create_autospec and dataclasses in 3.14.0b2 #135368

Closed
Assignees
sobolevn
Labels
3.14bugs and security fixes3.15new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-dataclassestype-bugAn unexpected behavior, bug, or error
@cdce8p

Description

@cdce8p

Bug report

Bug description:

fromdataclassesimportdataclassfromunittest.mockimportcreate_autospec@dataclassclassDescription:name:strmock=create_autospec(Description,instance=True)print(isinstance(mock,Description))
# 3.13.3True# 3.14.0b2False

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 fixes3.15new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-dataclassestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp