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_save_to_path(self, data_dir):
p = os.path.join(data_dir, 'rotterdam', 'rotterdam_subset.json')
cm = cityjson.load(p)
new_cos = {}
for co_id, co in cm.cityobjects.items():
co.attributes['cjio_test'] = 'made by Balázs'
new_cos[co_id] = co
cm.cityobjects = new_cos
p_out = os.path.join(data_dir, 'rotterdam_subset_cjio_test.json')
cityjson.save(cm, p_out)
def test_from_path(self, data_dir):
p = os.path.join(data_dir, 'rotterdam', 'rotterdam_subset.json')
cm = cityjson.load(p)
assert hasattr(cm, 'cityobjects')
assert '{71B60053-BC28-404D-BAB9-8A642AAC0CF4}' in cm.cityobjects
def test_to_dataframe(self, data_dir):
p = os.path.join(data_dir, 'rotterdam', 'rotterdam_subset.json')
cm = cityjson.load(p)
df = cm.to_dataframe()
assert len(df) == len(cm.cityobjects)