def test_clear_operation_links_end(self, graph, sum_op, square_op,
                                    negative_op):
     graph.add_operations(sum_op, square_op, negative_op)
     graph.add_link(sum_op, square_op, "sum", "n")
     graph.add_link(square_op, negative_op, "square", "num")
     graph.clear_operation_links(negative_op)
     assert graph.links() == [(sum_op, square_op, "sum", "n")]
 def test_clear_operation_links_unlinked_operation(self, graph, sum_op,
                                                   square_op):
     # TODO should this raise an exception?
     graph.add_operations(sum_op, square_op)
     graph.clear_operation_links(sum_op)
     assert graph.links() == []
 def test_clear_operation_links_bad_arg(self, graph):
     with pytest.raises(TypeError):
         graph.clear_operation_links("this should be an operation")
 def test_clear_operation_links_empty(self, graph, sum_op):
     graph.clear_operation_links(sum_op)
     assert graph.links() == []
     assert graph.get_outbound_links(sum_op) == {}
     assert graph.get_inbound_links(sum_op) == {}