Test whether ``edges_equal`` properly compares edges with attribute dictionaries.
()
| 331 | |
| 332 | |
| 333 | def test_edges_equal_data(): |
| 334 | """Test whether ``edges_equal`` properly compares edges with attribute dictionaries.""" |
| 335 | G = nx.path_graph(3) |
| 336 | H = nx.path_graph(3) |
| 337 | I = nx.path_graph(3, create_using=nx.MultiGraph) |
| 338 | |
| 339 | attrs = {(0, 1): {"attr1": 20, "attr2": "nothing"}, (1, 2): {"attr2": 3}} |
| 340 | nx.set_edge_attributes(G, attrs) |
| 341 | assert edges_equal(G.edges(data=True), G.edges(data=True)) |
| 342 | assert not edges_equal(G.edges(data=True), G.edges()) |
| 343 | |
| 344 | nx.set_edge_attributes(H, attrs) |
| 345 | assert edges_equal(G.edges(), H.edges()) |
| 346 | assert edges_equal(G.edges(data=True), H.edges(data=True)) |
| 347 | |
| 348 | H[0][1]["attr2"] = "something" |
| 349 | assert edges_equal(G.edges(), H.edges()) |
| 350 | assert not edges_equal(G.edges(data=True), H.edges(data=True)) |
| 351 | |
| 352 | |
| 353 | def test_edges_equal_multigraph_data(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…