Exemplo n.º 1
0
def test_query_matches_string_generates_lambda_filter_with_a_list_of_values():
    ('predicate("field").matches("string") with a list of values')

    query = predicate('name').matches('Foo Bar')
    result = list(filter(query, LIST_OF_VALUES))

    result.should.equal([
        "Foo Bar",
    ])
Exemplo n.º 2
0
def test_query_matches_string_generates_lambda_filter_with_list_of_dicts():
    ('predicate("field").matches("string") with a list of dicts')

    query = predicate('name').matches('Foo Bar')
    result = list(filter(query, LIST_OF_DICTS))

    result.should.equal([
        {"name": "Foo Bar"},
    ])
Exemplo n.º 3
0
def test_query_matches_regex_generates_lambda_filter_with_a_list_of_values():
    ('predicate("field").matches("regex") with a list of values against regex')

    query = predicate('name').regex.matches('oo')
    result = list(filter(query, LIST_OF_VALUES))

    result.should.equal([
        "Foo Bar",
        "Wee Woo",
    ])
Exemplo n.º 4
0
def test_query_matches_regex_generates_lambda_filter_with_list_of_dicts():
    ('predicate("field").matches("regex") with a list of dicts against regex')

    query = predicate('name').regex.matches('OO', re.IGNORECASE)
    result = list(filter(query, LIST_OF_DICTS))

    result.should.equal([
        {"name": "Foo Bar"},
        {"name": "Wee Woo"},
    ])
Exemplo n.º 5
0
def test_query_contains_generates_lambda_filter_with_a_list_of_values():
    ('predicate("field").contains("string") with a list of values')

    query = predicate('name').contains('oo')
    result = list(filter(query, LIST_OF_VALUES))

    result.should.equal([
        "Foo Bar",
        "Wee Woo",
    ])
Exemplo n.º 6
0
def test_query_contains_generates_lambda_filter_with_list_of_dicts():
    ('predicate("field").contains("string") with a list of dicts')

    query = predicate('name').contains('oo')
    result = list(filter(query, LIST_OF_DICTS))

    result.should.equal([
        {"name": "Foo Bar"},
        {"name": "Wee Woo"},
    ])