def function(mocker):
mock_search = mocker.patch.object(Class, "mock_function", return_value={})
if Class.function("param1", "param2"):
mock_search.assert_called_once_with("param1", "param2", url=default_url)
elif Class.function("param1", "param2", url="URL"):
mock_search.assert_called_once_with("param1", "param2", url="URL")
Is there a way to compact the code. It should execute such that if Class.function("param1", "param2", url="URL") has url passed in Class.function method, the assert_called_once_with should be executed with the passed URL (if not) execute with default url.