def test_should_save_data_to_file_using_default_protocol(self, pickle_mock):
data = 'data'
with patch('builtins.open', mock_open(read_data=data)) as file_mock:
save('dir/filename/', data, pickle.DEFAULT_PROTOCOL)
file_mock.assert_called_with('dir/filename/', 'wb')
pickle_mock.dump.assert_called_with(data, file_mock(), pickle.DEFAULT_PROTOCOL)
评论列表
文章目录