8000 gh-100690: Prevent prefix "called_" for attributes of safe mock objects by cklein · Pull Request #100691 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100690: Prevent prefix "called_" for attributes of safe mock objects #100691

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 6 commits into from
Jan 6, 2023
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
Next Next commit
Reformatted NEWS
  • Loading branch information
cklein committed Jan 6, 2023
commit e9b8f739a5790a8c4a7b9110a23ae70c1d76ffe8
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Mock objects which are not unsafe will now raise an AttributeError when accessing an
attribute that matches the name of an assertion but without the prefix ``assert_``, e.g. accessing ``called_once`` instead of ``assert_called_once``.
This is in addition to this already happening for accessing attributes with prefixes assert, assret, asert, aseert, and assrt.
``Mock`` objects which are not unsafe will now raise an
``AttributeError`` when accessing an attribute that matches the name
of an assertion but without the prefix ``assert_``, e.g. accessing
``called_once`` instead of ``assert_called_once``.
This is in addition to this already happening for accessing attributes
with prefixes ``assert``, ``assret``, ``asert``, ``aseert``,
and ``assrt``.
0