Ejemplo n.º 1
0
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) == []
Ejemplo n.º 2
0
def test_match_with_repeated_fields(animals):
    repeat = animals + animals[-1:]
    assert wcut.match_fields(repeat, animals) == [0, 1, 2]
Ejemplo n.º 3
0
def test_match_with_repeated_searches(animals):
    repeat = animals + ['parrot']
    assert wcut.match_fields(animals, repeat) == [0, 1]
Ejemplo n.º 4
0
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]
Ejemplo n.º 5
0
def test_match_partial(animals):
    partial = [a[:2] for a in animals]
    assert wcut.match_fields(animals, partial) == [0, 1]
Ejemplo n.º 6
0
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]
Ejemplo n.º 7
0
def test_match_with_empty_field(digits):
    assert wcut.match_fields(digits, ['']) == []
Ejemplo n.º 8
0
def test_no_matching_fields(digits, animals):
    assert wcut.match_fields(digits, animals) == []