forked from s_ranjbar/city_retrofit
Partially correct unit-test
This commit is contained in:
parent
0d63a6c4e9
commit
066a25bfee
|
@ -33,7 +33,7 @@ class TestCityMerge(TestCase):
|
||||||
self._executable = 'sra'
|
self._executable = 'sra'
|
||||||
|
|
||||||
def test_merge(self):
|
def test_merge(self):
|
||||||
file_path = Path('./tests_data/test.geojson').resolve()
|
file_path = Path(self._example_path / 'test.geojson').resolve()
|
||||||
full_city = GeometryFactory('geojson', file_path, height_field='citygml_me').city
|
full_city = GeometryFactory('geojson', file_path, height_field='citygml_me').city
|
||||||
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
||||||
odd_city = City(full_city.lower_corner, full_city.upper_corner, full_city.srs_name)
|
odd_city = City(full_city.lower_corner, full_city.upper_corner, full_city.srs_name)
|
||||||
|
@ -54,17 +54,17 @@ class TestCityMerge(TestCase):
|
||||||
|
|
||||||
def test_merge_with_radiation(self):
|
def test_merge_with_radiation(self):
|
||||||
sra = distutils.spawn.find_executable('sra')
|
sra = distutils.spawn.find_executable('sra')
|
||||||
file_path = Path('./tests_data/test.geojson').resolve()
|
file_path = Path(self._example_path / 'test.geojson').resolve()
|
||||||
output_path = Path('./tests_outputs/')
|
|
||||||
full_city = GeometryFactory('geojson', file_path, height_field='citygml_me').city
|
full_city = GeometryFactory('geojson', file_path, height_field='citygml_me').city
|
||||||
even_city = City(full_city.lower_corner, full_city.upper_corner, full_city.srs_name)
|
even_city = City(full_city.lower_corner, full_city.upper_corner, full_city.srs_name)
|
||||||
for building in full_city.buildings:
|
for building in full_city.buildings:
|
||||||
if int(building.name) % 2 == 0:
|
if int(building.name) % 2 == 0:
|
||||||
even_city.add_city_object(copy.deepcopy(building))
|
even_city.add_city_object(copy.deepcopy(building))
|
||||||
ExportsFactory('sra', full_city, output_path).export()
|
ExportsFactory('sra', full_city, self._output_path).export()
|
||||||
sra_file = str((output_path / f'{full_city.name}_sra.xml').resolve())
|
sra_file = str((self._output_path / f'{full_city.name}_sra.xml').resolve())
|
||||||
subprocess.run([sra, sra_file], stdout=subprocess.DEVNULL)
|
subprocess.run([sra, sra_file], stdout=subprocess.DEVNULL)
|
||||||
ResultFactory('sra', full_city, output_path).enrich()
|
ResultFactory('sra', full_city, self._output_path).enrich()
|
||||||
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
||||||
merged_city = full_city.merge(even_city)
|
merged_city = full_city.merge(even_city)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user