diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-09-28 15:15:22 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-09-28 15:15:22 (GMT) |
commit | 28d591ceef337cc37c4b44d7958dea3f59d92018 (patch) | |
tree | 41b989c914e0a0b5e78b37dd9d19319e3284246b /Lib/unittest/test | |
parent | 494502756eb7283631930c18ccaa6b137959d961 (diff) | |
download | cpython-28d591ceef337cc37c4b44d7958dea3f59d92018.zip cpython-28d591ceef337cc37c4b44d7958dea3f59d92018.tar.gz cpython-28d591ceef337cc37c4b44d7958dea3f59d92018.tar.bz2 |
Closes issue 15323. Improve failure message of Mock.assert_called_once_with
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/testmock/testmock.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py index 64fd1a1..2c6f128 100644 --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -463,6 +463,13 @@ class MockTest(unittest.TestCase): mock.assert_called_with) + def test_assert_called_once_with_message(self): + mock = Mock(name='geoffrey') + self.assertRaisesRegex(AssertionError, + r"Expected 'geoffrey' to be called once\.", + mock.assert_called_once_with) + + def test__name__(self): mock = Mock() self.assertRaises(AttributeError, lambda: mock.__name__) |