MCPcopy
hub / github.com/networkx/networkx / test_add_edge

Method test_add_edge

networkx/classes/tests/test_digraph.py:236–248  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

234 assert sorted(G.pred.items()) == [(1, {2: {}}), (2, {1: {}})]
235
236 def test_add_edge(self):
237 G = self.Graph()
238 G.add_edge(0, 1)
239 assert G.adj == {0: {1: {}}, 1: {}}
240 assert G.succ == {0: {1: {}}, 1: {}}
241 assert G.pred == {0: {}, 1: {0: {}}}
242 G = self.Graph()
243 G.add_edge(*(0, 1))
244 assert G.adj == {0: {1: {}}, 1: {}}
245 assert G.succ == {0: {1: {}}, 1: {}}
246 assert G.pred == {0: {}, 1: {0: {}}}
247 with pytest.raises(ValueError, match="None cannot be a node"):
248 G.add_edge(None, 3)
249
250 def test_add_edges_from(self):
251 G = self.Graph()

Callers

nothing calls this directly

Calls 1

add_edgeMethod · 0.95

Tested by

no test coverage detected