def test_ws_when_is_last_evaluation_for_output_port(): pg = PortGraph() pg.add_vertex(0) pg.add_out_port(0, "out", 0) ws = WorkflowState(pg) ws.set_last_evaluation(0, 1) assert ws.when(0) == 1
def test_ws_nodes_last_evaluation(): pg = PortGraph() pg.add_vertex(0) pg.add_vertex(1) ws = WorkflowState(pg) ws.set_last_evaluation(0, 1) assert ws.last_evaluation(0) == 1 assert ws.last_evaluation(1) is None
def test_ws_when_connected_input_port(): pg = PortGraph() pg.add_vertex(0) pg.add_out_port(0, "out", 0) pg.add_vertex(1) pg.add_out_port(1, "out", 1) pg.add_vertex(2) pg.add_in_port(2, "in", 2) pg.connect(0, 2) ws = WorkflowState(pg) assert ws.when(2) is None ws.set_last_evaluation(0, 10) assert ws.when(2) == 10 pg.connect(1, 2) ws = WorkflowState(pg) assert ws.when(2) is None ws.set_last_evaluation(0, 10) assert ws.when(2) is None ws.set_last_evaluation(1, 11) assert ws.when(2) == 10