(self)
| 69 | pytest.raises(nx.NetworkXError, to_networkx_graph, "a") |
| 70 | |
| 71 | def test_digraphs(self): |
| 72 | for dest, source in [ |
| 73 | (to_dict_of_dicts, from_dict_of_dicts), |
| 74 | (to_dict_of_lists, from_dict_of_lists), |
| 75 | ]: |
| 76 | G = cycle_graph(10) |
| 77 | |
| 78 | # Dict of [dicts, lists] |
| 79 | dod = dest(G) |
| 80 | GG = source(dod) |
| 81 | assert nodes_equal(sorted(G.nodes()), sorted(GG.nodes())) |
| 82 | assert edges_equal(sorted(G.edges()), sorted(GG.edges())) |
| 83 | GW = to_networkx_graph(dod) |
| 84 | assert nodes_equal(sorted(G.nodes()), sorted(GW.nodes())) |
| 85 | assert edges_equal(sorted(G.edges()), sorted(GW.edges())) |
| 86 | GI = nx.Graph(dod) |
| 87 | assert nodes_equal(sorted(G.nodes()), sorted(GI.nodes())) |
| 88 | assert edges_equal(sorted(G.edges()), sorted(GI.edges())) |
| 89 | |
| 90 | G = cycle_graph(10, create_using=nx.DiGraph) |
| 91 | dod = dest(G) |
| 92 | GG = source(dod, create_using=nx.DiGraph) |
| 93 | assert sorted(G.nodes()) == sorted(GG.nodes()) |
| 94 | assert sorted(G.edges()) == sorted(GG.edges()) |
| 95 | GW = to_networkx_graph(dod, create_using=nx.DiGraph) |
| 96 | assert sorted(G.nodes()) == sorted(GW.nodes()) |
| 97 | assert sorted(G.edges()) == sorted(GW.edges()) |
| 98 | GI = nx.DiGraph(dod) |
| 99 | assert sorted(G.nodes()) == sorted(GI.nodes()) |
| 100 | assert sorted(G.edges()) == sorted(GI.edges()) |
| 101 | |
| 102 | def test_graph(self): |
| 103 | g = nx.cycle_graph(10) |
nothing calls this directly
no test coverage detected