Beispiel #1
0
def test_component_as_dict_contains_links():
    name = "link1"
    target = "/entry/instrument/something"
    test_component = Component(name="test")
    test_component[name] = Link(parent_node=None, name=name, source=target)

    dictionary_output = test_component.as_dict([])

    assert dictionary_output["children"][0]["config"]["name"] == name
    assert dictionary_output["children"][0]["config"]["source"] == target
    assert dictionary_output["children"][0]["module"] == "link"
Beispiel #2
0
def test_component_as_dict_contains_stream_field():
    source = "PVS:pv1"
    topic = "topic1"
    name = "stream1"
    test_component = Component(name="test")
    test_component[name] = NS10Stream(parent_node=None, source=source, topic=topic)

    dictionary_output = test_component.as_dict([])

    assert dictionary_output["children"][0]["module"] == "ns10"
    assert dictionary_output["children"][0]["config"]["topic"] == topic
    assert dictionary_output["children"][0]["config"]["source"] == source
Beispiel #3
0
def test_component_as_dict_contains_transformations():
    zeroth_transform_name = "test_transform_A"
    first_transform_name = "test_transform_B"
    test_component = Component(name="test_component")

    first_transform = test_component.add_translation(
        name=first_transform_name, vector=QVector3D(1, 0, 0)
    )
    zeroth_transform = test_component.add_translation(
        name=zeroth_transform_name,
        vector=QVector3D(0, 0, 1),
        depends_on=first_transform,
    )
    test_component.depends_on = zeroth_transform
    dictionary_output = test_component.as_dict([])

    assert dictionary_output["children"][0]["name"] == TRANSFORMS_GROUP_NAME
    child_names = [
        child["config"]["name"]
        for child in dictionary_output["children"][0]["children"]
    ]
    assert zeroth_transform_name in child_names
    assert first_transform_name in child_names