in doubles/method_double.py [0:0]
def _find_matching_double(self, args, kwargs):
"""Returns the first matching expectation or allowance.
Returns the first allowance or 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 ``Allowance`` or ``Expectation``, if one was found.
:rtype: Allowance, Expectation, None
"""
expectation = self._find_matching_expectation(args, kwargs)
if expectation:
return expectation
allowance = self._find_matching_allowance(args, kwargs)
if allowance:
return allowance