Exemple #1
0
def test_iadd_tag_config(test_cfg: tags.TagConfig) -> None:
    cfg2 = tags.TagConfig()
    cfg2.insert_tag_group(
        tags.TagGroup.from_config({
            "id":
            "tgid3",
            "title":
            "titlor",
            "topic":
            "Topics",
            "tags": [{
                "id": "tgid3",
                "title": "tagid3",
                "aux_tags": [],
            }],
        }))
    cfg2.insert_tag_group(
        tags.TagGroup.from_config({
            "id":
            "tgid2",
            "title":
            "BLAAA",
            "tags": [{
                "id": "tgid2",
                "title": "tagid2",
                "aux_tags": []
            }],
        }))
    cfg2.aux_tag_list.append(
        tags.AuxTag.from_config({
            "id": "blub",
            "title": "BLUB"
        }))
    cfg2.aux_tag_list.append(
        tags.AuxTag.from_config({
            "id": "bla",
            "title": "BLUB"
        }))

    test_cfg += cfg2

    assert len(test_cfg.tag_groups) == 6
    assert test_cfg.tag_groups[0].id == "criticality"
    assert test_cfg.tag_groups[1].id == "networking"
    assert test_cfg.tag_groups[2].id == "none_choice"
    assert test_cfg.tag_groups[3].id == "none_2"
    assert test_cfg.tag_groups[4].id == "tgid3"
    assert test_cfg.tag_groups[4].title == "titlor"

    aux_tags = test_cfg.get_aux_tags()
    assert len(aux_tags) == 2
    assert aux_tags[0].id == "bla"
    assert aux_tags[0].title == "bläää"
    assert aux_tags[1].id == "blub"
Exemple #2
0
def test_iadd_tag_config(test_cfg: tags.TagConfig) -> None:
    cfg2 = tags.TagConfig()
    cfg2.insert_tag_group(tags.TagGroup(("tgid3", "Topics/titlor", [("tgid3", "tagid3", [])])))
    cfg2.insert_tag_group(tags.TagGroup(("tgid2", "BLAAA", [("tgid2", "tagid2", [])])))
    cfg2.aux_tag_list.append(tags.AuxTag(("blub", "BLUB")))
    cfg2.aux_tag_list.append(tags.AuxTag(("bla", "BLUB")))

    test_cfg += cfg2

    assert len(test_cfg.tag_groups) == 6
    assert test_cfg.tag_groups[0].id == "criticality"
    assert test_cfg.tag_groups[1].id == "networking"
    assert test_cfg.tag_groups[2].id == "none_choice"
    assert test_cfg.tag_groups[3].id == "none_2"
    assert test_cfg.tag_groups[4].id == "tgid3"
    assert test_cfg.tag_groups[4].title == "titlor"

    aux_tags = test_cfg.get_aux_tags()
    assert len(aux_tags) == 2
    assert aux_tags[0].id == "bla"
    assert aux_tags[0].title == "bläää"
    assert aux_tags[1].id == "blub"
Exemple #3
0
def test_tag_config_get_aux_tags(test_cfg: tags.TagConfig) -> None:
    assert [a.id for a in test_cfg.get_aux_tags()] == ["bla"]