summer_course_2024/tests/test_imports.py
2021-04-07 14:39:50 -04:00

36 lines
1.0 KiB
Python

"""
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
"""
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):
if self._city_obj is None:
file_path = (self._example_path / 'kelowna.obj').resolve()
self._city_obj = GeometryFactory('obj', file_path).city
return self._city_obj
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')