예제 #1
0
def test_unknown_element() -> None:
    group_list = tsrc.GroupList(elements={"a", "b", "c"})
    with pytest.raises(tsrc.UnknownGroupElement) as e:
        group_list.add("invalid-group", {"no-such-element"})
    assert e.value.group_name == "invalid-group"
    assert e.value.element == "no-such-element"
예제 #2
0
def test_happy_grouping() -> None:
    group_list = tsrc.GroupList(elements={"a", "b", "b", "c"})
    group_list.add("default", {"a", "b"})
    group_list.add("other", {"c"}, includes=["default"])
    actual = group_list.get_elements(groups=["other"])
    assert actual == {"a", "b", "c"}
예제 #3
0
def test_default_is_all() -> None:
    group_list = tsrc.GroupList(elements={"a", "b", "c"})
    assert group_list.get_elements() == {"a", "b", "c"}
예제 #4
0
def test_ping_pong() -> None:
    group_list = tsrc.GroupList(elements={"a", "b"})
    group_list.add("ping", {"a"}, includes=["pong"])
    group_list.add("pong", {"b"}, includes=["ping"])
    actual = group_list.get_elements(groups=["ping"])
    assert actual == {"a", "b"}