def matches(self, actual): try: match = self.expected.search(actual) except TypeError: return match_failure("Invalid value %s (%s)" % (repr(actual), type(actual))) return match_result(match is not None, got_value(actual))
def matches(self, actual): results = [] is_success = True for matcher in self.matchers: result = matcher.matches(actual) results.append((matcher, result)) if result.is_failure(): is_success = False break match_details = "\n".join( [got() + ":"] + _make_items([ _serialize_sub_matcher_result(matcher, result) for matcher, result in results ], relationship="and") ) return match_result(is_success, match_details)
def matches(self, actual): return match_result(self.min <= actual <= self.max, got_value(actual))
def matches(self, actual): return match_result(comparison_func(actual, self.expected), got_value(actual))
def matches(self, actual): result = self.matcher.matches(actual) return match_result(not result.outcome, result.description)
def matches(self, actual): return match_result(self.expected in actual, got_value(actual))
def matches(self, actual): return match_result(actual.endswith(self.expected), got_value(actual))