Example #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
Example #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
Example #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')
Example #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')
Example #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}]