mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode (#12991)
* bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode * Make the requested changes.
This commit is contained in:
parent
6bd81734de
commit
b9b08cd948
2 changed files with 5 additions and 3 deletions
|
@ -572,7 +572,8 @@ class NonCallableMock(Base):
|
|||
raise AttributeError(name)
|
||||
if not self._mock_unsafe:
|
||||
if name.startswith(('assert', 'assret')):
|
||||
raise AttributeError(name)
|
||||
raise AttributeError("Attributes cannot start with 'assert' "
|
||||
"or 'assret'")
|
||||
|
||||
result = self._mock_children.get(name)
|
||||
if result is _deleted:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue