diff --git a/tests/test_physics_factory.py b/tests/test_physics_factory.py index 5654c957..024223ef 100644 --- a/tests/test_physics_factory.py +++ b/tests/test_physics_factory.py @@ -38,7 +38,7 @@ class TestPhysicsFactory(TestCase): def test_city_with_physics(self): """ - Enrich the city with the physic information and verify ot + Enrich the city with the physic information and verify it :return: None """ city = self._get_city_with_physics() diff --git a/tests/test_usage_factory.py b/tests/test_usage_factory.py new file mode 100644 index 00000000..bb9b582c --- /dev/null +++ b/tests/test_usage_factory.py @@ -0,0 +1,58 @@ +""" +TestUsageFactory test and validate the city model structure usage parameters +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es +""" +from pathlib import Path +from unittest import TestCase + +from factories.geometry_factory import GeometryFactory +from factories.usage_factory import UsageFactory + + +class TestUsageFactory(TestCase): + """ + TestUsageFactory TestCase + """ + def setUp(self) -> None: + """ + Configure test environment + :return: + """ + self._city_gml = None + self._nyc_with_usage = None + self._example_path = (Path(__file__).parent.parent / 'tests_data').resolve() + + def _get_citygml(self): + if self._city_gml is None: + file_path = (self._example_path / '20buildings.gml').resolve() + self._city_gml = GeometryFactory('citygml', file_path).city + self.assertIsNotNone(self._city_gml, 'city is none') + return self._city_gml + + def _get_city_with_usage(self): + if self._nyc_with_usage is None: + self._nyc_with_usage = self._get_citygml() + UsageFactory('us_new_york', self._nyc_with_usage) + return self._nyc_with_usage + + def test_city_with_usage(self): + """ + Enrich the city with the usage information and verify it + :return: None + """ + city = self._get_city_with_usage() + for building in city.buildings: + for usage_zone in building.usage_zones: + self.assertIsNotNone(usage_zone.usage, 'usage is none') + self.assertIsNotNone(usage_zone.internal_gains, 'usage is none') + self.assertIsNotNone(usage_zone.cooling_setpoint, 'usage is none') + self.assertIsNotNone(usage_zone.heating_setback, 'usage is none') + self.assertIsNotNone(usage_zone.heating_setpoint, 'usage is none') + self.assertIsNotNone(usage_zone.occupancy_density, 'usage is none') + self.assertIsNotNone(usage_zone.hours_day, 'usage is none') + self.assertIsNotNone(usage_zone.days_year, 'usage is none') + self.assertIsNotNone(usage_zone.dhw_average_volume_pers_day, 'usage is none') + self.assertIsNotNone(usage_zone.dhw_preparation_temperature, 'usage is none') + self.assertIsNotNone(usage_zone.electrical_app_average_consumption_sqm_year, 'usage is none') + # todo: missing occupancy, schedules and heating schedule