hub/tests/test_exports.py

44 lines
1.3 KiB
Python
Raw Normal View History

"""
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
2021-03-16 20:14:40 -04:00
from city_model_structure.city import City
2021-03-16 16:58:52 -04:00
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:
2021-03-16 20:14:40 -04:00
file_path = (self._example_path / 'one_building_in_kelowna_populated_weather_demand.pickle').resolve()
2021-03-17 09:23:48 -04:00
self._city_gml = 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')
2021-03-16 20:14:40 -04:00
def test_energy_ade_export(self):
self._export('energy_ade')