from unittest import TestCase from pathlib import Path from geometry.geometry_factory import GeometryFactory from physics.physics_factory import PhysicsFactory 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() 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()