()
| 77 | |
| 78 | @unittest.skipIf(F._default_context_str == "gpu", reason="GPU not implemented") |
| 79 | def test_graph_serialize_without_feature(): |
| 80 | num_graphs = 100 |
| 81 | g_list = [generate_rand_graph(30) for _ in range(num_graphs)] |
| 82 | |
| 83 | # create a temporary file and immediately release it so DGL can open it. |
| 84 | f = tempfile.NamedTemporaryFile(delete=False) |
| 85 | path = f.name |
| 86 | f.close() |
| 87 | |
| 88 | dgl.save_graphs(path, g_list) |
| 89 | |
| 90 | idx_list = np.random.permutation(np.arange(num_graphs)).tolist() |
| 91 | loadg_list, _ = dgl.load_graphs(path, idx_list) |
| 92 | |
| 93 | idx = idx_list[0] |
| 94 | load_g = loadg_list[0] |
| 95 | |
| 96 | assert F.allclose(load_g.nodes(), g_list[idx].nodes()) |
| 97 | |
| 98 | load_edges = load_g.all_edges("uv", "eid") |
| 99 | g_edges = g_list[idx].all_edges("uv", "eid") |
| 100 | assert F.allclose(load_edges[0], g_edges[0]) |
| 101 | assert F.allclose(load_edges[1], g_edges[1]) |
| 102 | |
| 103 | os.unlink(path) |
| 104 | |
| 105 | |
| 106 | @unittest.skipIf(F._default_context_str == "gpu", reason="GPU not implemented") |
nothing calls this directly
no test coverage detected