

def _matches(self, subject):
    if isinstance(subject, _compat.string_types):
        return self.__match_string(subject)
    reasons = []
    try:
        for (index, expected_item) in enumerate(self._expected):
            expected_item = default_matcher(expected_item)
            (result, _) = expected_item._match(subject[index])
            if (not result):
                return (False, ['item {0!r} not found at index {1}'.format(expected_item, index)])
            else:
                reasons.append('item {0!r} found at index {1}'.format(expected_item, index))
    except IndexError:
        return (False, ['item {0!r} not found at index {1}'.format(expected_item, index)])
    if (len(subject) != len(reasons)):
        return (False, ['have a different length'])
    return (True, reasons)

dataset/ETHPy150Open jaimegildesagredo/expects/expects/matchers/built_in/contain.py contain_exactly._matches/original