Exemplo n.º 1
0
def test_lookup_table_with_empty_values():
    assert lookup_table((), operator.itemgetter(0)) == {}
Exemplo n.º 2
0
def test_lookup_table_with_empty_values(key):
    assert lookup_table((), key) == {}
Exemplo n.º 3
0
def test_lookup_table(values, key):
    expected = {"b": {"bar", "baz"}, "f": {"foo"}, "q": {"quux", "qux"}}
    assert lookup_table(values, key) == expected
Exemplo n.º 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)