in doubles/method_double.py [0:0]
def _find_matching_expectation(self, args, kwargs):
"""Return a matching expectation.
Returns the first expectation that matches the ones declared. Tries one with specific
arguments first, then falls back to an expectation that allows arbitrary arguments.
:return: The matching ``Expectation``, if one was found.
:rtype: Expectation, None
"""
for expectation in self._expectations:
if expectation.satisfy_exact_match(args, kwargs):
return expectation
for expectation in self._expectations:
if expectation.satisfy_custom_matcher(args, kwargs):
return expectation
for expectation in self._expectations:
if expectation.satisfy_any_args_match():
return expectation