hub/tests/test_imports.py

36 lines
1.0 KiB
Python
Raw Normal View History

"""
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
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:
file_path = (self._example_path / 'kelowna.obj').resolve()
self._city_obj = GeometryFactory('obj', file_path)._city_debug
2021-04-07 14:20:13 -04:00
return self._city_obj
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')