Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> import mock
- >>> m = mock.Mock()
- >>> m.assert_called_once() # Old version of Mock? This may not be what you expect.
- <Mock name='mock.assert_called_once()' id='4558624144'>
- >>> assert_called_once = mock.Mock.assert_called_once # Doesn't exist. Now you know!
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AttributeError: type object 'Mock' has no attribute 'assert_called_once'
- >>> assert_called_once_with = mock.Mock.assert_called_once_with # There it is.
- >>> assert_called_once_with(m) # This does the right thing.
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File ".../mock.py", line 845, in assert_called_once_with
- raise AssertionError(msg)
- AssertionError: Expected to be called once. Called 0 times.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement