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