def test_match_search_with_complement(animals): assert wcut.match_fields(animals, ['otter'], complement=True) == [0] assert wcut.match_fields(animals, ['otter', 'seal'], complement=True) == []
def test_match_with_repeated_fields(animals): repeat = animals + animals[-1:] assert wcut.match_fields(repeat, animals) == [0, 1, 2]
def test_match_with_repeated_searches(animals): repeat = animals + ['parrot'] assert wcut.match_fields(animals, repeat) == [0, 1]
def test_match_wholename(animals): partial = [a[:2] for a in animals] assert wcut.match_fields(animals, partial, wholename=True) == [] assert wcut.match_fields(animals, animals, wholename=True) == [0, 1]
def test_match_partial(animals): partial = [a[:2] for a in animals] assert wcut.match_fields(animals, partial) == [0, 1]
def test_match_case_sensitive(animals): upper = [a.upper() for a in animals] assert wcut.match_fields(upper, animals) == [] assert wcut.match_fields(upper, animals, ignore_case=True) == [0, 1]
def test_match_with_empty_field(digits): assert wcut.match_fields(digits, ['']) == []
def test_no_matching_fields(digits, animals): assert wcut.match_fields(digits, animals) == []