""" TestSchedulesFactory test and validate the city model structure schedules SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author 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.usage_factory import UsageFactory from imports.schedules_factory import SchedulesFactory from imports.geometry_feeders.helpers.geometry_helper import GeometryHelper class TestSchedulesFactory(TestCase): """ TestSchedulesFactory TestCase """ def setUp(self) -> None: """ Configure test environment :return: """ self._city_gml = None self._example_path = (Path(__file__).parent / 'tests_data').resolve() def _get_citygml(self, file): file_path = (self._example_path / file).resolve() self._city = GeometryFactory('citygml', file_path).city self.assertIsNotNone(self._city, 'city is none') for building in self._city.buildings: building.function = GeometryHelper.pluto_to_function[building.function] UsageFactory('hft', self._city) return self._city def test_comnet_archetypes(self): file = (self._example_path / 'pluto_building.gml').resolve() city = self._get_citygml(file) occupancy_handler = 'comnet' SchedulesFactory(occupancy_handler, city) for building in city.buildings: for usage_zone in building.usage_zones: self.assertTrue(usage_zone.schedules)