Exemplo n.º 1
0
def test_where():
    data = [{'a': 1, 'b': 2}, {'a': 10, 'b': 2}]
    assert where(data, a=1) == [{'a': 1, 'b': 2}]
    assert where(data, a=1, b=2) == [{'a': 1, 'b': 2}]
    assert where(data, b=2) == data
Exemplo n.º 2
0
def test_where():
    data = [{'a': 1, 'b': 2}, {'a': 10, 'b': 2}]
    assert where(data, a=1) == [{'a': 1, 'b': 2}]
    assert where(data, a=1, b=2) == [{'a': 1, 'b': 2}]
    assert where(data, b=2) == data
Exemplo n.º 3
0
def find_api(method_name):
    """ Given a method name, find its API. """
    endpoint = first(where(api_methods, method=method_name))
    if endpoint:
        return endpoint.get('api')
Exemplo n.º 4
0
def find_api(method_name):
    """ Given a method name, find its API. """
    endpoint = first(where(api_methods, method=method_name))
    if endpoint:
        return endpoint.get('api')
Exemplo n.º 5
0
def test_where_nonexistent_key():
    data = [{'a': 1}, {'b': 2}]
    assert where(data, a=1) == [{'a': 1}]
    assert where(data, b=2) == [{'b': 2}]