예제 #1
0
def test_hashmap_super_function():
    data = geometry.GeometryCollection([
        geometry.Polygon([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]),
        geometry.Polygon([[1, 0], [2, 0], [2, 1], [1, 1], [1, 0]]),
    ])
    topo = Hashmap(data).to_dict()
    geoms = topo["objects"]["data"]["geometries"][0]["geometries"]

    assert len(list(topo.keys())) == 6
    assert geoms[0]["arcs"] == [[-3, 0]]
    assert geoms[1]["arcs"] == [[1, 2]]
예제 #2
0
 def test_super_function_hashmap(self):
     data = geometry.GeometryCollection([
         geometry.Polygon([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]),
         geometry.Polygon([[1, 0], [2, 0], [2, 1], [1, 1], [1, 0]]),
     ])
     topo = Hashmap(data).to_dict()
     geoms = topo["objects"]["data"]["geometries"][0]["geometries"]
     self.assertEqual(list(topo.keys()),
                      ["type", "linestrings", "objects", "options", "bbox"])
     self.assertEqual(geoms[0]["arcs"], [[-3, 0]])
     self.assertEqual(geoms[1]["arcs"], [[1, 2]])