| 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() |