2021-11-13 00:55:04 -05:00
|
|
|
"""
|
|
|
|
Building test
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2021-11-22 20:57:29 -05:00
|
|
|
Copyright © 2020 Project Author Atiya atiya.atiya@mail.concordia.ca
|
|
|
|
Contributor Mohammad Reza mohammad.seyedabadi@mail.concordia.ca
|
2021-11-13 00:55:04 -05:00
|
|
|
"""
|
|
|
|
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:
|
|
|
|
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:
|
|
|
|
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:
|
|
|
|
self.assertTrue(len(city.machines) > 0)
|
|
|
|
|
2021-11-15 08:24:03 -05:00
|
|
|
def test_material(self):
|
|
|
|
city_file = "../unittests/tests_data/C40_Final.gml"
|
|
|
|
city = GeometryFactory('citygml', city_file).city
|
|
|
|
LifeCycleAssessment('material', city).enrich()
|
2022-03-02 12:56:20 -05:00
|
|
|
self.assertTrue(len(city.lca_materials) > 0)
|
|
|
|
for lca_material in city.lca_materials:
|
|
|
|
lca_mat = city.lca_material(lca_material.id)
|
|
|
|
self.assertTrue(lca_mat is not None)
|
2021-11-15 08:24:03 -05:00
|
|
|
|
2021-11-13 00:55:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
|