MCPcopy
hub / github.com/networkx/networkx / test_edges_equal_weighted

Function test_edges_equal_weighted

networkx/utils/tests/test_misc.py:319–330  ·  view source on GitHub ↗

Test whether ``edges_equal`` properly compares edges with weight data.

(n, gen, weight)

Source from the content-addressed store, hash-verified

317@pytest.mark.parametrize("gen", [nx.complete_graph, nx.path_graph, nx.cycle_graph])
318@pytest.mark.parametrize("weight", [1, 2, 3])
319def test_edges_equal_weighted(n, gen, weight):
320 """Test whether ``edges_equal`` properly compares edges with weight data."""
321 G = gen(n)
322 H = gen(n)
323
324 G_edges = list(G.edges())
325 G.add_weighted_edges_from((*e, weight) for e in G_edges)
326 assert edges_equal(G.edges(), G.edges())
327
328 H.add_weighted_edges_from((*e, weight + 1) for e in G_edges)
329 assert edges_equal(H.edges(), H.edges())
330 assert not edges_equal(G.edges(data=True), H.edges(data=True))
331
332
333def test_edges_equal_data():

Callers

nothing calls this directly

Calls 3

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…