@songying
2018-07-18T21:40:16.000000Z
字数 656
阅读 1104
unittest
https://docs.python.org/3.4/library/unittest.mock.html
https://docs.python.org/3.4/library/unittest.mock-examples.html
class unittest.mock.Mock(spec=None, side_effect=None, return_value=DEFAULT, wraps=None, name=None, spec_set=None, **kwargs)
- spec:
- spec_set:
assert_called_with()
assert_called_with(*args, **kwargs)
assert_called_once_with()
assert_called_once_with(*args, **kwargs)
assert_any_call()
assert_any_call(*args, **kwargs)
assert_has_calls()
assert_has_calls(calls, any_order=False)
reset_mock()
configure_mock()
unittest.mock.patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)