MCPcopy
hub / github.com/networkx/networkx / test_edges_equal_data

Function test_edges_equal_data

networkx/utils/tests/test_misc.py:333–350  ·  view source on GitHub ↗

Test whether ``edges_equal`` properly compares edges with attribute dictionaries.

()

Source from the content-addressed store, hash-verified

331
332
333def 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
353def test_edges_equal_multigraph_data():

Callers

nothing calls this directly

Calls 2

edges_equalFunction · 0.90
edgesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…