Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_build_index(self, lod):
co = models.CityObject(id='one')
geom = models.Geometry(type='Solid', lod=lod)
co.geometry.append(geom)
geometry, vtx_lookup, vtx_idx = co.build_index()
assert 'semantics' not in geometry[0]
parents = co['parents'] if 'parents' in co else None
attributes = co['attributes'] if 'attributes' in co else None
# cast to objects
geometry = []
for geom in co['geometry']:
semantics = geom['semantics'] if 'semantics' in geom else None
geometry.append(
models.Geometry(
type=geom['type'],
lod=geom['lod'],
boundaries=geom['boundaries'],
semantics_obj=semantics,
vertices=rotterdam_subset.j['vertices']
)
)
rotterdam_subset.cityobjects[co_id] = models.CityObject(
id=id,
type=co['type'],
attributes=attributes,
children=children,
parents=parents,
geometry=geometry
)
yield rotterdam_subset
parents = co['parents'] if 'parents' in co else None
attributes = co['attributes'] if 'attributes' in co else None
# cast to objects
geometry = []
for geom in co['geometry']:
semantics = geom['semantics'] if 'semantics' in geom else None
geometry.append(
models.Geometry(
type=geom['type'],
lod=geom['lod'],
boundaries=geom['boundaries'],
semantics_obj=semantics,
vertices=rotterdam_subset.j['vertices']
)
)
rotterdam_subset.cityobjects[co_id] = models.CityObject(
id=id,
type=co['type'],
attributes=attributes,
children=children,
parents=parents,
geometry=geometry
)
yield rotterdam_subset
parents = co['parents'] if 'parents' in co else None
attributes = co['attributes'] if 'attributes' in co else None
# cast to objects
geometry = []
for geom in co['geometry']:
semantics = geom['semantics'] if 'semantics' in geom else None
geometry.append(
models.Geometry(
type=geom['type'],
lod=geom['lod'],
boundaries=geom['boundaries'],
semantics_obj=semantics,
vertices=zurich_subset.j['vertices']
)
)
zurich_subset.cityobjects[co_id] = models.CityObject(
id=co_id,
type=co['type'],
attributes=attributes,
children=children,
parents=parents,
geometry=geometry
)
return zurich_subset