From 4a235e9e9e5eaf4826ebe95af70f1147e71806a1 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 15 Jun 2020 14:59:53 -0400 Subject: [PATCH] Correct the existing unit tests --- helpers/configuration_helper.py | 3 +-- tests/test_geometry_factory.py | 20 ++++++++++---------- tests/test_physics_factory.py | 2 -- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/helpers/configuration_helper.py b/helpers/configuration_helper.py index c46f8f31..3b821ca2 100644 --- a/helpers/configuration_helper.py +++ b/helpers/configuration_helper.py @@ -12,8 +12,7 @@ class ConfigurationHelper: Configuration class """ def __init__(self): - base_path = Path().resolve().parent - config_file = Path(base_path / 'libs/config/configuration.ini').resolve() + config_file = Path(Path(__file__).parent.parent / 'config/configuration.ini').resolve() self._config = configparser.ConfigParser() self._config.read(config_file) diff --git a/tests/test_geometry_factory.py b/tests/test_geometry_factory.py index 7d763035..aa1e42b0 100644 --- a/tests/test_geometry_factory.py +++ b/tests/test_geometry_factory.py @@ -115,16 +115,16 @@ class TestGeometryFactory(TestCase): self.assertIsNotNone(thermal_zone.floor_area, 'thermal_zone floor_area is none') self.assertIsNotNone(thermal_zone.heated, 'thermal_zone heated is none') self.assertIsNotNone(thermal_zone.cooled, 'thermal_zone cooled is none') - self.assertIsNone(thermal_zone.additional_thermal_bridge_u_value, - 'thermal_zone additional_thermal_bridge_u_value is not none') + self.assertEqual(thermal_zone.additional_thermal_bridge_u_value, 0.0, + 'thermal_zone additional_thermal_bridge_u_value is not 0.0') self.assertIsNone(thermal_zone.effective_thermal_capacity, 'thermal_zone effective_thermal_capacity is not none') - self.assertIsNone(thermal_zone.indirectly_heated_area_ratio, - 'thermal_zone indirectly_heated_area_ratio is not none') + self.assertEqual(thermal_zone.indirectly_heated_area_ratio, 0.0, + 'thermal_zone indirectly_heated_area_ratio is not none') self.assertIsNone(thermal_zone.infiltration_rate_system_off, 'thermal_zone infiltration_rate_system_off is not none') - self.assertIsNone(thermal_zone.infiltration_rate_system_on, - 'thermal_zone infiltration_rate_system_on is not none') + self.assertEqual(thermal_zone.infiltration_rate_system_on, 0.0, + 'thermal_zone infiltration_rate_system_on is not none') self.assertIsNone(thermal_zone.usage_zones, 'thermal_zone usage_zones are not none') @@ -168,14 +168,14 @@ class TestGeometryFactory(TestCase): for thermal_zone in city_object.thermal_zones: for thermal_boundary in thermal_zone.bounded: for thermal_opening in thermal_boundary.thermal_openings: - self.assertIsNone(thermal_opening.area, 'thermal_opening area was initialized') self.assertTrue(thermal_opening.frame_ratio == 0, 'thermal_opening frame_ratio was not 0') self.assertIsNone(thermal_opening.g_value, 'thermal_opening g_value was initialized') self.assertIsNone(thermal_opening.conductivity, 'thermal_opening conductivity_w_mk was initialized') - self.assertIsNone(thermal_opening.inside_reflectance, 'thermal_opening inside_reflectance was initialized') + self.assertIsNone(thermal_opening.back_side_solar_transmittance_at_normal_incidence, + 'thermal_opening back_side_solar_transmittance_at_normal_incidence was initialized') self.assertRaises(Exception, lambda: thermal_opening.openable_ratio, 'thermal_opening openable_ratio is not raising an exception') - self.assertIsNone(thermal_opening.outside_reflectance, - 'thermal_opening outside_reflectance was initialized') + self.assertIsNone(thermal_opening.front_side_solar_transmittance_at_normal_incidence, + 'thermal_opening front_side_solar_transmittance_at_normal_incidence was initialized') self.assertIsNone(thermal_opening.thickness, 'thermal_opening thickness_m was initialized') self.assertRaises(Exception, lambda: thermal_opening.u_value, 'thermal_opening u_value was initialized') diff --git a/tests/test_physics_factory.py b/tests/test_physics_factory.py index cfe848b9..fa2818a7 100644 --- a/tests/test_physics_factory.py +++ b/tests/test_physics_factory.py @@ -54,7 +54,5 @@ class TestPhysicsFactory(TestCase): self.assertIsNotNone(thermal_zone.bounded, 'bounded is none') for thermal_boundary in thermal_zone.bounded: self.assertIsNotNone(thermal_boundary.outside_solar_absorptance, 'outside_solar_absorptance is none') - self.assertIsNotNone(thermal_boundary.outside_thermal_absorptance, 'outside_thermal_absorptance is none') - self.assertIsNotNone(thermal_boundary.outside_visible_absorptance, 'outside_visible_absorptance is none') self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none') self.assertIsNotNone(thermal_boundary.layers, 'layers is none')