def test_toggle_default(self, graph, sum_op): graph.add_operation(sum_op) return_value = graph.toggle_disabled(sum_op) assert graph.disabled(sum_op) is True assert return_value == [] return_value = graph.toggle_disabled(sum_op) assert graph.disabled(sum_op) is False assert return_value == []
def test_toggle_with_links(self, graph, a_op, b_op, c_op): graph.add_operations(a_op, b_op, c_op) link1 = (a_op, b_op, "n", "n") link2 = (b_op, c_op, "n", "n") graph.add_link(*link1) graph.add_link(*link2) return_value = graph.toggle_disabled(a_op) assert graph.disabled(a_op) is True assert return_value == [] assert graph.links() == [link2] return_value = graph.toggle_disabled(a_op) assert graph.disabled(a_op) is False assert return_value == [] assert graph.links() == [link1, link2]
def test_toggle_with_links_unmatched_names(self, graph, sum_op, square_op, negative_op): graph.add_operations(sum_op, square_op, negative_op) link1 = (sum_op, square_op, "sum", "n") link2 = (square_op, negative_op, "square", "num") graph.add_link(*link1) graph.add_link(*link2) return_value = graph.toggle_disabled(sum_op) assert graph.disabled(sum_op) is True assert return_value == [] assert graph.links() == [] return_value = graph.toggle_disabled(sum_op) assert graph.disabled(sum_op) is False assert return_value == [] assert graph.links() == []
def test_toggle_disabled_remove_false(self, graph, sum_op, square_op, negative_op): graph.add_operations(sum_op, square_op, negative_op) link1 = (sum_op, square_op, "sum", "n") link2 = (square_op, negative_op, "square", "num") graph.add_link(*link1) graph.add_link(*link2) return_value = graph.toggle_disabled(sum_op, remove_orphan_links=False) assert graph.disabled(sum_op) is True assert return_value == graph.operation_links(sum_op) assert graph.links() == [link1, link2] return_value = graph.toggle_disabled(sum_op, remove_orphan_links=False) assert graph.disabled(sum_op) is False assert return_value == [] assert graph.links() == [link1, link2]
def test_toggle_remove_false_unmatched_names(self, graph, sum_op, square_op, negative_op): graph.add_operations(sum_op, square_op, negative_op) link1 = (sum_op, square_op, "sum", "n") link2 = (square_op, negative_op, "square", "num") graph.add_link(*link1) graph.add_link(*link2) graph._pretty_print() return_value = graph.toggle_disabled(sum_op, remove_orphan_links=False) graph._pretty_print() assert graph.disabled(sum_op) is True assert return_value == [link1] assert graph.links() == [] return_value = graph.toggle_disabled(sum_op, remove_orphan_links=False) assert graph.disabled(sum_op) is False assert return_value == [] assert graph.links() == []