Partially correct unit-test

This commit is contained in:
Guille Gutierrez 2023-07-25 15:36:49 -04:00
parent 0d63a6c4e9
commit 066a25bfee

View File

@ -33,7 +33,7 @@ class TestCityMerge(TestCase):
self._executable = 'sra'
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
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)
@ -54,17 +54,17 @@ class TestCityMerge(TestCase):
def test_merge_with_radiation(self):
sra = distutils.spawn.find_executable('sra')
file_path = Path('./tests_data/test.geojson').resolve()
output_path = Path('./tests_outputs/')
file_path = Path(self._example_path / 'test.geojson').resolve()
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)
for building in full_city.buildings:
if int(building.name) % 2 == 0:
even_city.add_city_object(copy.deepcopy(building))
ExportsFactory('sra', full_city, output_path).export()
sra_file = str((output_path / f'{full_city.name}_sra.xml').resolve())
ExportsFactory('sra', full_city, self._output_path).export()
sra_file = str((self._output_path / f'{full_city.name}_sra.xml').resolve())
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')
merged_city = full_city.merge(even_city)