2021-04-07 11:47:39 -04:00
|
|
|
"""
|
|
|
|
TestImports test and validate the city export formats
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 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
|
|
|
|
|
|
|
|
|
|
|
|
class MyTestCase(TestCase):
|
|
|
|
"""
|
|
|
|
TestImports
|
|
|
|
"""
|
|
|
|
def setUp(self) -> None:
|
|
|
|
"""
|
|
|
|
Test setup
|
|
|
|
:return: None
|
|
|
|
"""
|
2021-04-07 14:20:13 -04:00
|
|
|
self._city_obj = None
|
2021-04-07 11:47:39 -04:00
|
|
|
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
|
|
|
|
self._output_path = (Path(__file__).parent / 'tests_outputs').resolve()
|
|
|
|
|
|
|
|
def _get_city(self):
|
2021-04-07 14:20:13 -04:00
|
|
|
if self._city_obj is None:
|
2021-04-07 11:47:39 -04:00
|
|
|
file_path = (self._example_path / 'kelowna.obj').resolve()
|
2021-05-25 13:34:57 -04:00
|
|
|
self._city_obj = GeometryFactory('obj', file_path)._city_debug
|
2021-04-07 14:20:13 -04:00
|
|
|
return self._city_obj
|
2021-04-07 11:47:39 -04:00
|
|
|
|
2021-04-07 14:20:13 -04:00
|
|
|
def test_import_obj(self):
|
|
|
|
city = self._get_city()
|
|
|
|
self.assertIsNotNone(city, 'city is none')
|
|
|
|
for building in city.buildings:
|
|
|
|
self.assertIsNotNone(building, 'building is none')
|