def assert_has_calls(self, calls, any_order=False):
if not any_order:<EOL><INDENT>if calls not in self.mock_calls:<EOL><INDENT>raise AssertionError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (calls, self.mock_calls)<EOL>)<EOL><DEDENT>return<EOL><DEDENT>all_calls = list(self.mock_calls)<EOL>not_found = []<EOL>for kall in calls:<EOL><INDENT>try:<EOL><INDENT>all_calls.remove(kall)<EOL><DEDENT>except ValueError:<EOL><INDENT>not_found.append(kall)<EOL><DEDENT><DEDENT>if not_found:<EOL><INDENT>raise AssertionError(<EOL>'<STR_LIT>' % (tuple(not_found),)<EOL>)<EOL><DEDENT>
assert the mock has been called with the specified calls.
        The `mock_calls` list is checked for the calls.

        If `any_order` is False (the default) then the calls must be
        sequential. There can be extra calls before or after the
        specified calls.

        If `any_order` is True then the calls can be in any order, but
        they must all appear in `mock_calls`.