diff options
author | Christian Klein <167265+cklein@users.noreply.github.com> | 2023-01-06 18:38:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 18:38:50 (GMT) |
commit | 1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909 (patch) | |
tree | 3fc895376703b2960e4e7776a21868d9fdaba4b4 /Misc | |
parent | 9ffbc58f5cb6d2b002f8785886588d646af517db (diff) | |
download | cpython-1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909.zip cpython-1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909.tar.gz cpython-1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909.tar.bz2 |
gh-100690: Raise an AttributeError when the assert_ prefix is forgotten 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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-01-02-16-59-49.gh-issue-100690.2EgWPS.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-01-02-16-59-49.gh-issue-100690.2EgWPS.rst b/Misc/NEWS.d/next/Library/2023-01-02-16-59-49.gh-issue-100690.2EgWPS.rst new file mode 100644 index 0000000..3796772 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-01-02-16-59-49.gh-issue-100690.2EgWPS.rst @@ -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``. |