-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-100690: Raise an AttributeError when the assert_ prefix is forgott…
…en when using Mock (#100691) 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. Backports: 1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909 Signed-off-by: Chris Withers <chris@simplistix.co.uk>
- Loading branch information
Showing
3 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters