diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-05-08 17:32:24 (GMT) |
---|---|---|
committer | Kushal Das <mail@kushaldas.in> | 2019-05-08 17:32:23 (GMT) |
commit | b9b08cd948de97d756a199b60becce8397a8c882 (patch) | |
tree | f694404dcb4599d035307c9c7e3074e603da76f4 /Lib/unittest/test | |
parent | 6bd81734de0b73f1431880d6a75fb71bcbc65fa1 (diff) | |
download | cpython-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/test')
-rw-r--r-- | Lib/unittest/test/testmock/testmock.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py index 5f917dd..b20b8e2 100644 --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -1453,9 +1453,10 @@ class MockTest(unittest.TestCase): #Issue21238 def test_mock_unsafe(self): m = Mock() - with self.assertRaises(AttributeError): + msg = "Attributes cannot start with 'assert' or 'assret'" + with self.assertRaisesRegex(AttributeError, msg): m.assert_foo_call() - with self.assertRaises(AttributeError): + with self.assertRaisesRegex(AttributeError, msg): m.assret_foo_call() m = Mock(unsafe=True) m.assert_foo_call() |