bpo-41877: Improve docs for assert misspellings check in mock (GH-23729)

This is a follow-up to
4662fa9bfe.
That original commit expanded guards against misspelling assertions on
mocks. This follow-up updates the documentation and improves the error
message by pointing out the potential cause and solution.

Automerge-Triggered-By: GH:gpshead
This commit is contained in:
vabr-g 2020-12-10 19:35:28 +01:00 committed by GitHub
parent b5c7b38f5e
commit 9fc571359a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View file

@ -1598,7 +1598,7 @@ class MockTest(unittest.TestCase):
#Issue21238
def test_mock_unsafe(self):
m = Mock()
msg = "Attributes cannot start with 'assert' or its misspellings"
msg = "is not a valid assertion. Use a spec for the mock"
with self.assertRaisesRegex(AttributeError, msg):
m.assert_foo_call()
with self.assertRaisesRegex(AttributeError, msg):