""" TestCustomizedImportsFactory tests and validates the factory to import customized data SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2021 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ from pathlib import Path from unittest import TestCase from imports.geometry_factory import GeometryFactory from imports.construction_factory import ConstructionFactory from imports.customized_imports_factory import CustomizedImportsFactory from imports.customized_imports.sanam_customized_usage_parameters import SanamCustomizedUsageParameters as scp class TestCustomizedImportsFactory(TestCase): """ TestCustomizedImportsFactory TestCase """ def setUp(self) -> None: """ Configure test environment :return: """ self._example_path = (Path(__file__).parent / 'tests_data').resolve() def _get_citygml(self, file): file_path = (self._example_path / file).resolve() _city = GeometryFactory('citygml', file_path).city self.assertIsNotNone(_city, 'city is none') ConstructionFactory('nrel', _city).enrich() return _city def test_city_with_customized_data(self): """ Enrich the city with the usage information and verify it :return: None """ file = 'one_building_in_kelowna.gml' city = self._get_citygml(file) CustomizedImportsFactory(scp, city).enrich() for building in city.buildings: self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined') for usage_zone in building.usage_zones: self.assertIsNotNone(usage_zone.mechanical_air_change, 'usage is none')