city_retrofit/tests/test_physics_factory.py

27 lines
971 B
Python
Raw Normal View History

2020-05-29 07:25:33 -04:00
from unittest import TestCase
from pathlib import Path
from geometry.geometry_factory import GeometryFactory
from physics.physics_factory import PhysicsFactory
2020-05-29 07:25:33 -04:00
class TestPhysicsFactory(TestCase):
def setUp(self) -> None:
self._city_gml = None
self._nyc_with_physics = None
self._example_path = (Path(__file__).parent.parent / 'tests_data').resolve()
2020-05-29 07:25:33 -04:00
def get_citygml(self):
if self._city_gml is None:
file_path = (self._example_path / 'buildings.gml').resolve()
self._city_gml = GeometryFactory('citygml', file_path).city
self.assertIsNotNone(self._city_gml, 'city is none')
return self._city_gml
def get_city_with_physics(self):
if self._nyc_with_physics is None:
self._nyc_with_physics = self.get_citygml()
PhysicsFactory('us_new_york_city', self._nyc_with_physics, base_path=self._example_path)
return self._nyc_with_physics
def test_city_with_physics(self):
city = self.get_city_with_physics()