From 35e50cf5516f64a86d1a6d7bcef3cdf25fb376fe Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 25 Jul 2023 16:00:14 -0400 Subject: [PATCH] Partially correct unit-test --- tests/test_energy_systems_air_source_hp.py | 8 ++++++-- tests/test_energy_systems_water_to_water_hp.py | 7 +++++-- tests/test_greenery_in_idf.py | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_energy_systems_air_source_hp.py b/tests/test_energy_systems_air_source_hp.py index e4930953..be6b230d 100644 --- a/tests/test_energy_systems_air_source_hp.py +++ b/tests/test_energy_systems_air_source_hp.py @@ -4,6 +4,8 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2022 Concordia CERC group Project Coder Peter Yefi peteryefi@gmail.com """ +from pathlib import Path + import pandas as pd from unittest import TestCase from hub.imports.geometry_factory import GeometryFactory @@ -38,8 +40,10 @@ class TestEnergySystemsFactory(TestCase): Test setup :return: None """ - city_file = "tests_data/C40_Final.gml" - self._output_path = "tests_data/as_user_output.csv" + self._example_path = (Path(__file__).parent / 'tests_data').resolve() + self._output_path = (Path(__file__).parent / 'tests_outputs').resolve() + city_file = (self._example_path/"C40_Final.gml").resolve() + self._output_path = (self._output_path/"as_user_output.csv").resolve() self._city = GeometryFactory('citygml', path=city_file).city EnergySystemsFactory('air_source_hp', self._city).enrich() diff --git a/tests/test_energy_systems_water_to_water_hp.py b/tests/test_energy_systems_water_to_water_hp.py index 084f0c59..50f0c384 100644 --- a/tests/test_energy_systems_water_to_water_hp.py +++ b/tests/test_energy_systems_water_to_water_hp.py @@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2022 Concordia CERC group Project Coder Peter Yefi peteryefi@gmail.com """ +from pathlib import Path from unittest import TestCase import pandas as pd @@ -24,8 +25,10 @@ class TestEnergySystemsFactory(TestCase): Test setup :return: None """ - city_file = "tests_data/C40_Final.gml" - self._output_path = "tests_data/w2w_user_output.csv" + self._example_path = (Path(__file__).parent / 'tests_data').resolve() + self._output_path = (Path(__file__).parent / 'tests_outputs').resolve() + city_file = (self._example_path / "C40_Final.gml").resolve() + self._output_path = (self._output_path / "w2w_user_output.csv").resolve() self._city = GeometryFactory('citygml', path=city_file).city EnergySystemsFactory('water_to_water_hp', self._city).enrich() diff --git a/tests/test_greenery_in_idf.py b/tests/test_greenery_in_idf.py index 52129de2..ecbbe02b 100644 --- a/tests/test_greenery_in_idf.py +++ b/tests/test_greenery_in_idf.py @@ -24,8 +24,7 @@ class GreeneryInIdf(TestCase): """ def test_greenery_in_idf(self): city_file = "tests_data/one_building_in_kelowna.gml" - output_path = Path('tests_outputs/').resolve() - + output_path = (Path(__file__).parent / 'tests_outputs').resolve() city = GeometryFactory('citygml', path=city_file).city for building in city.buildings: building.year_of_construction = 2006