Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-124176: Add special support for dataclasses to create_autospec #124429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address review
  • Loading branch information
sobolevn committed Sep 26, 2024
commit de9a328acd8b29d42f3e1e3dec3670133b25ee74
2 changes: 0 additions & 2 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2757,8 +2757,6 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
is_async_func = _is_async_func(spec)

entries = [(entry, _missing) for entry in dir(spec)]
# Not using `is_dataclass` to avoid an import of dataclasses module
# for types that don't need that.
if is_type and instance and is_dataclass(spec):
dataclass_fields = fields(spec)
entries.extend((f.name, f.type) for f in dataclass_fields)
Expand Down
Loading