Пример #1
0
def test_lookup_table_with_empty_values():
    assert lookup_table((), operator.itemgetter(0)) == {}
Пример #2
0
def test_lookup_table_with_empty_values(key):
    assert lookup_table((), key) == {}
Пример #3
0
def test_lookup_table(values, key):
    expected = {"b": {"bar", "baz"}, "f": {"foo"}, "q": {"quux", "qux"}}
    assert lookup_table(values, key) == expected
Пример #4
0
def test_lookup_table_requires_key(values):
    with pytest.raises(
        ValueError,
        match=r"^The `key` function must be specified when the `values` are not empty\.$",
    ):
        lookup_table(values)