hub/unittests/test_life_cycle_assessment_factory.py
2021-11-15 11:07:16 -05:00

59 lines
1.7 KiB
Python

"""
Building test
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez Morote Guillermo.GutierrezMorote@concordia.ca
"""
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.life_cycle_assessment_factory import LifeCycleAssessment
class TestLifeCycleAssessment(TestCase):
"""
TestBuilding TestCase 1
"""
def setUp(self) -> None:
"""
Test setup
:return: None
"""
self._city_gml = None
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
def test_fuel(self):
city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('fuel', city).enrich()
for fuel in city.fuels:
# print(fuel.name)
self.assertTrue(len(city.fuels) > 0)
def test_vehicle(self):
city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('vehicle', city).enrich()
for vehicle in city.vehicles:
# print(vehicle.name)
self.assertTrue(len(city.vehicles) > 0)
def test_machine(self):
city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('machine', city).enrich()
for machine in city.machines:
# print(machine.name)
self.assertTrue(len(city.machines) > 0)
def test_material(self):
city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('material', city).enrich()
for material in city.materials:
print(material.material_name)
self.assertTrue(len(city.materials) > 0)