Skip to content

Mock configuration shortcuts#109

Merged
kaste merged 2 commits intomasterfrom
mock-shorts
Feb 24, 2026
Merged

Mock configuration shortcuts#109
kaste merged 2 commits intomasterfrom
mock-shorts

Conversation

@kaste
Copy link
Owner

@kaste kaste commented Feb 24, 2026

No description provided.

Add a normalization pipeline for constructor-dict shorthands in mock().
This now supports explicit async key prefixes, protocol defaults for
context managers, iterable wrappers for __iter__/__aiter__, and widening
of zero-arg lambda shorthands to accept arbitrary call arguments.

Keep async intent stable across follow-up when(...)-based restubbing by
tracking methods marked as coroutine in Mock and consulting that marker
when building StubbedInvocation instances.

Add focused tests that cover the new shorthand behavior and edge cases,
including async marker usage, default enter/exit installation, and
async iterator normalization. Also add implementation notes to
mock_shorthands.rst.
Add a dedicated docs/mock-shorthands.rst page that explains
constructor-dict shorthand behavior for mock(), including async
method markers, context manager helpers, and iterator shortcuts.

Link the new page from docs/index.rst so it appears in the documentation
toctree.
@kaste kaste merged commit 48ab3c3 into master Feb 24, 2026
50 checks passed
@kaste kaste deleted the mock-shorts branch February 24, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant