city_retrofit/tests/test_exports.py
2021-03-16 20:14:40 -04:00

44 lines
1.3 KiB
Python

"""
TestExports test and validate the city export formats
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from exports.exports_factory import ExportsFactory
from city_model_structure.city import City
class TestExports(TestCase):
"""
TestGeometryFactory TestCase 1
"""
def setUp(self) -> None:
"""
Test setup
:return: None
"""
self._city_gml = None
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
self._output_path = (Path(__file__).parent / 'tests_outputs').resolve()
def _get_city(self):
if self._city_gml is None:
file_path = (self._example_path / 'one_building_in_kelowna_populated_weather_demand.pickle').resolve()
city = City.load(file_path)
return self._city_gml
def _export(self, export_type):
self._city_gml = self._get_city()
ExportsFactory(export_type, self._city_gml, self._output_path).export
def test_obj_export(self):
self._export('obj')
def test_stl_export(self):
self._export('stl')
def test_energy_ade_export(self):
self._export('energy_ade')