|
6 | 6 |
|
7 | 7 | import contrib.regionTrimmer as region_trimmer
|
8 | 8 |
|
9 |
| - |
10 | 9 | class TestRegionTrimmer(unittest.TestCase):
|
11 | 10 | def test_get_nodes(self):
|
12 | 11 | coords = [(0, 0), (0, -1), (-1, 0), (-1, -1)]
|
@@ -46,13 +45,24 @@ def test_get_graph_center_by_bounds(self):
|
46 | 45 |
|
47 | 46 | def test_generate_edges(self):
|
48 | 47 | graph = networkx.Graph()
|
49 |
| - graph.add_nodes_from([(0, 0), (0, -1), (-1, 0), (-1, -1)]) |
50 |
| - |
| 48 | + graph.add_nodes_from( |
| 49 | + [(0, 0), (0, -1), (-1, 0), (-1, -1)] |
| 50 | + ) |
51 | 51 | graph = region_trimmer.generate_edges(graph)
|
52 |
| - expected = [((-1, 0), (-1, -1)), |
53 |
| - ((0, -1), (-1, -1)), |
54 |
| - ((0, 0), (-1, -1)), |
55 |
| - ((0, 0), (-1, 0)), |
56 |
| - ((0, 0), (0, -1))] |
57 |
| - |
58 |
| - self.assertListEqual(sorted(list(graph.edges)), expected) |
| 52 | + self.assertEqual( |
| 53 | + graph.adj, |
| 54 | + { |
| 55 | + (0, -1): {(0, 0): {}, (-1, -1): {}}, |
| 56 | + (0, 0): { |
| 57 | + (0, -1): {}, |
| 58 | + (-1, 0): {}, |
| 59 | + (-1, -1): {}, |
| 60 | + }, |
| 61 | + (-1, 0): {(0, 0): {}, (-1, -1): {}}, |
| 62 | + (-1, -1): { |
| 63 | + (0, -1): {}, |
| 64 | + (0, 0): {}, |
| 65 | + (-1, 0): {}, |
| 66 | + }, |
| 67 | + }, |
| 68 | + ) |
0 commit comments