def test_write_read_p2g(self): fh = io.BytesIO() G = nx.DiGraph() G.name = "foo" G.add_edges_from([("a", "b"), ("b", "c")]) write_p2g(G, fh) fh.seek(0) H = read_p2g(fh) assert edges_equal(G.edges(), H.edges())
def test_write_read_p2g(self): fh = io.BytesIO() G = nx.DiGraph() G.name = 'foo' G.add_edges_from([('a', 'b'), ('b', 'c')]) write_p2g(G, fh) fh.seek(0) H = read_p2g(fh) assert_edges_equal(G.edges(), H.edges())
def test_write_p2g(self): s = b"""foo 3 2 1 1 2 2 3 """ fh = io.BytesIO() G = nx.OrderedDiGraph() G.name = "foo" G.add_edges_from([(1, 2), (2, 3)]) write_p2g(G, fh) fh.seek(0) r = fh.read() assert r == s