forked from s_ranjbar/city_retrofit
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
"""
|
|
Building test
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2020 Project Author Guille Gutierrez Morote Guillermo.GutierrezMorote@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.construction_factory import ConstructionFactory
|
|
from exports.exports_factory import ExportsFactory
|
|
import helpers.constants as cte
|
|
|
|
|
|
class TestBuildings(TestCase):
|
|
"""
|
|
TestBuilding TestCase 1
|
|
"""
|
|
def setUp(self) -> None:
|
|
"""
|
|
Test setup
|
|
:return: None
|
|
"""
|
|
self._city_gml = None
|
|
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
|
|
|
|
def test_doe_idf(self):
|
|
city_file = "../unittests/tests_data/C40_Final.gml"
|
|
output_path = Path('../unittests/tests_outputs/').resolve()
|
|
city = GeometryFactory('citygml', city_file).city
|
|
ConstructionFactory('nrel', city).enrich()
|
|
UsageFactory('ca', city).enrich()
|
|
SchedulesFactory('doe_idf', city).enrich()
|
|
ExportsFactory('idf', city, output_path).export()
|
|
self.assertEqual(10, len(city.buildings))
|
|
for building in city.buildings:
|
|
self.assertTrue(len(building.usage_zones) > 0)
|
|
for usage_zone in building.usage_zones:
|
|
self.assertIsNot(len(usage_zone.schedules), 0, 'no usage_zones schedules defined')
|
|
for schedule in usage_zone.schedules:
|
|
self.assertIsNotNone(schedule.type)
|
|
print(schedule.type)
|
|
self.assertIsNotNone(schedule.values)
|
|
print(schedule.values)
|
|
self.assertIsNotNone(schedule.data_type)
|
|
self.assertIsNotNone(schedule.time_step)
|
|
self.assertIsNotNone(schedule.time_range)
|
|
self.assertIsNotNone(schedule.day_types)
|
|
|
|
|