def test_adding_duplicate_edges_to_a_weight_graph_adds_unique_edges(num): """Test that adding duplicate edges to the graph unique edges.""" from weight_graph import Graph g = Graph() for x in range(num): g.add_edge(x % 5, x % 5 + 1, x + 1) assert len(g.edges()) == 5 if num > 5 else num
def test_adding_unique_edges_to_a_weight_graph_adds_all_edges(num): """Test that adding unique edges to the weight graph adds all edges.""" from weight_graph import Graph g = Graph() for x in range(num): g.add_edge(x, x + 1, x + 2) assert len(g.edges()) == num
def test_edges_of_filled_weight_graph_has_all_edges(num): """Test that edges lists all the edges in a graph.""" from weight_graph import Graph g = Graph() for x in range(num): g.add_edge(x, x + 1, x + 2) assert len(g.edges()) == num
def test_edge(node, result): """Test to check if all edges are there.""" from weight_graph import Graph g = Graph() for idx in node: g.add_node(idx) g.add_edge(2, 3) g.add_edge(1, 4) assert g.edges() == result