Esempio n. 1
0
def test_that_checks_multiple_nodeoutput_types():
    versatile_output = NodeOutput(dummy_node, "versatile_output", [int])
    versatile_output.set([1, 2, 3, 4])

    assert versatile_output.get()[0] == 1
    assert versatile_output.get()[1] == 2
    assert versatile_output.get()[2] == 3
    assert versatile_output.get()[3] == 4

    beautiful_output = NodeOutput(
        dummy_node,
        "beautiful_output",
        {
            "a": [int],
            "b": {
                "c": [[int]]
            },
            "d": [{
                "e": str
            }]
        },
    )
    beautiful_output.set({
        "a": [44],
        "b": {
            "c": [[22]]
        },
        "d": [{
            "e": "hello"
        }, {
            "e": "goodbye"
        }]
    })

    assert beautiful_output.get()["a"][0] == 44
    assert beautiful_output.get()["b"]["c"][0][0] == 22
    assert beautiful_output.get()["d"][0]["e"] == "hello"
    assert beautiful_output.get()["d"][1]["e"] == "goodbye"
Esempio n. 2
0
def test_that_check_nodeoutput_value_getter():
    str_output = NodeOutput(dummy_node, "str_output", str)
    str_output.set("Strange string")
    assert str_output.get() == "Strange string"