Exemplo n.º 1
0
def test_find_by_name__list__not_found():
    items = [
        {"test_id": 1, "test_name": "name"},
        {"test_id": 2, "test_name": "name1"},
    ]
    assert utils.find_by_name(items, ["test", "name1", "name"], "test") == [
        None,
        2,
        1,
    ]
Exemplo n.º 2
0
def test_find_by_name__list():
    items = [
        {
            "test_id": 1,
            "test_name": "name"
        },
        {
            "test_id": 2,
            "test_name": "name1"
        },
    ]
    assert utils.find_by_name(items, ["name1", "name"], "test") == [2, 1]
Exemplo n.º 3
0
def test_find_by_name():
    items = [
        {
            "test_id": 1,
            "test_name": "name"
        },
        {
            "test_id": 2,
            "test_name": "name1"
        },
    ]
    assert utils.find_by_name(items, "name1", "test") == 2
Exemplo n.º 4
0
def test_find_by_name__no_field():
    items = [
        {
            "test_id": 1,
            "test_name": "name"
        },
        {
            "test_id": 2,
            "test_name": "name1"
        },
    ]
    assert utils.find_by_name(items, "test3", "test") is None