Small correction in unittests

This commit is contained in:
Guille Gutierrez 2023-01-25 06:38:08 -05:00
parent 2cfe3b7af8
commit b4b75b5e12
4 changed files with 6 additions and 16 deletions

View File

@ -55,6 +55,7 @@ class GeometryFactory:
:return: City :return: City
""" """
if self._data_frame is None: if self._data_frame is None:
print(self._path)
self._data_frame = geopandas.read_file(self._path) self._data_frame = geopandas.read_file(self._path)
return GPandas(self._data_frame).city return GPandas(self._data_frame).city
@ -96,4 +97,6 @@ class GeometryFactory:
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: City :return: City
""" """
return Geojson(self._path, self._height_field, self._year_of_construction_field, self._function_field).city if self._data_frame is None:
self._data_frame = geopandas.read_file(self._path)
return GPandas(self._data_frame).city

View File

@ -39,7 +39,7 @@ class TestEnergySystemsFactory(TestCase):
:return: None :return: None
""" """
city_file = "tests_data/C40_Final.gml" city_file = "tests_data/C40_Final.gml"
self._output_path = "/tests_data/as_user_output.csv" self._output_path = "tests_data/as_user_output.csv"
self._city = GeometryFactory('citygml', path=city_file).city self._city = GeometryFactory('citygml', path=city_file).city
EnergySystemsFactory('air source hp', self._city).enrich() EnergySystemsFactory('air source hp', self._city).enrich()

View File

@ -40,7 +40,7 @@ class TestEnergySystemsFactory(TestCase):
:return: None :return: None
""" """
city_file = "tests_data/C40_Final.gml" city_file = "tests_data/C40_Final.gml"
self._output_path = "/tests_data/w2w_user_output.csv" self._output_path = "tests_data/w2w_user_output.csv"
self._city = GeometryFactory('citygml', path=city_file).city self._city = GeometryFactory('citygml', path=city_file).city
EnergySystemsFactory('water to water hp', self._city).enrich() EnergySystemsFactory('water to water hp', self._city).enrich()

View File

@ -133,19 +133,6 @@ class TestGeometryFactory(TestCase):
for building in city.buildings: for building in city.buildings:
self._check_surfaces(building) self._check_surfaces(building)
def test_import_geopandas(self):
"""
Test geopandas import
"""
file = 'sample.geojson'
city = self._get_city(file, 'gpandas')
self.assertTrue(len(city.buildings) == 1)
self._check_buildings(city)
for building in city.buildings:
self._check_surfaces(building)
self.assertEqual(1912.0898135701814, building.volume)
self.assertEqual(146.19493345171213, building.floor_area)
def test_import_geojson(self): def test_import_geojson(self):
""" """
Test geojson import Test geojson import