summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-08 17:32:24 (GMT)
committerKushal Das <mail@kushaldas.in>2019-05-08 17:32:23 (GMT)
commitb9b08cd948de97d756a199b60becce8397a8c882 (patch)
treef694404dcb4599d035307c9c7e3074e603da76f4 /Lib/unittest/mock.py
parent6bd81734de0b73f1431880d6a75fb71bcbc65fa1 (diff)
downloadcpython-b9b08cd948de97d756a199b60becce8397a8c882.zip
cpython-b9b08cd948de97d756a199b60becce8397a8c882.tar.gz
cpython-b9b08cd948de97d756a199b60becce8397a8c882.tar.bz2
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.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r--Lib/unittest/mock.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 1e8057d..47ed06c 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -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: