def _match(self, subject): result, _ = default_matcher(self._times)._match(len(self._calls_matching(subject))) reasons = ['calls were:'] if not subject.double._recorded: reasons.append('No one') else: reasons.extend([str(i) for i in subject.double._recorded]) return result, reasons
def _match(self, path): path = self._resource_for(path) reasons = [] if not path.exists: reasons.append('does not exist') return default_matcher(self._expected)._match(path.group)[0], reasons
def _match(self, subject): result, _ = default_matcher(self._times)._match( len(self._calls_matching(subject))) reasons = ['calls were:'] if not subject.double._recorded: reasons.append('No one') else: reasons.extend([str(i) for i in subject.double._recorded]) return result, reasons
def _match(self, path): path = self._resource_for(path) reasons = [] if not path.exists: reasons.append('does not exist') else: reasons.append('has mode {}'.format(oct(path.mode))) return default_matcher(self._expected)._match(path.mode)[0], reasons
def _match_kwargs(self, call): for k, matcher in self._kwargs.items(): try: value = call.kargs[k] except KeyError: return False else: matcher = default_matcher(matcher) result, _ = matcher._match(value) if not result: return False return True
def _match_kwargs(self, call): for k, matcher in self._kwargs.items(): try: value = call.kargs[k] except KeyError: return False else: matcher = default_matcher(matcher) result, _ = matcher._match(value) if not result: return False return True
def _match_args(self, call): for i, matcher in enumerate(self._args): if matcher is any_arg: return True try: arg = call.args[i] except IndexError: return False else: matcher = default_matcher(matcher) result, _ = matcher._match(arg) if not result: return False return True
def _match_args(self, call): for i, matcher in enumerate(self._args): if matcher is any_arg: return True try: arg = call.args[i] except IndexError: return False else: matcher = default_matcher(matcher) result, _ = matcher._match(arg) if not result: return False return True