def test_remove_edge(): node1 = Node(1, adjacency_dict={2: {'weight': 3, 'status': True}}) node2 = Node(2, adjacency_dict={1: {'weight': 3, 'status': True}}) node3 = Node(3) test_net = Network({1: node1, 2: node2}) # test nodes are connected assert node2.node_id in node1.adjacency_dict assert node1.node_id in node2.adjacency_dict # remove edge test_net.remove_edge(node1.node_id, node2.node_id) assert node2.node_id not in node1.adjacency_dict assert node1.node_id not in node2.adjacency_dict assert not node1.adjacency_dict assert not node2.adjacency_dict assert len(test_net.network_dict) is 2 # attempt to remove edge with no shared edge test_net.remove_edge(node1.node_id, node3.node_id) assert not node1.adjacency_dict assert not node2.adjacency_dict assert len(test_net.network_dict) is 2 # attempt to remove edge from a node that doesn't exist test_net.remove_edge(node1.node_id, 4) assert not node1.adjacency_dict assert not node2.adjacency_dict assert len(test_net.network_dict) is 2
node_3.node_id: node_3, node_4.node_id: node_4, node_5.node_id: node_5, node_6.node_id: node_6, node_7.node_id: node_7, node_8.node_id: node_8, node_9.node_id: node_9, node_10.node_id: node_10 }) # demonstrates __str__() function works print(network_1) # demonstrates remove_edge function works print('\t---REMOVE EDGE---') network_1.remove_edge(1, 2) print(network_1) # demonstrates remove_node function works print('\t---REMOVE NODE---') network_1.remove_node(3) print(network_1) # demonstrates add edge function works print('\t---ADD EDGE---') network_1.add_edge(1, 2, 15) print(network_1) # demonstrates the add node function works print('\t---ADD NODE---') network_1.add_node(