Correct the existing unit tests

This commit is contained in:
Guille Gutierrez 2020-06-15 14:59:53 -04:00
parent 89ba809691
commit 4a235e9e9e
3 changed files with 11 additions and 14 deletions

View File

@ -12,8 +12,7 @@ class ConfigurationHelper:
Configuration class Configuration class
""" """
def __init__(self): def __init__(self):
base_path = Path().resolve().parent config_file = Path(Path(__file__).parent.parent / 'config/configuration.ini').resolve()
config_file = Path(base_path / 'libs/config/configuration.ini').resolve()
self._config = configparser.ConfigParser() self._config = configparser.ConfigParser()
self._config.read(config_file) self._config.read(config_file)

View File

@ -115,16 +115,16 @@ class TestGeometryFactory(TestCase):
self.assertIsNotNone(thermal_zone.floor_area, 'thermal_zone floor_area is none') 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.heated, 'thermal_zone heated is none')
self.assertIsNotNone(thermal_zone.cooled, 'thermal_zone cooled is none') self.assertIsNotNone(thermal_zone.cooled, 'thermal_zone cooled is none')
self.assertIsNone(thermal_zone.additional_thermal_bridge_u_value, self.assertEqual(thermal_zone.additional_thermal_bridge_u_value, 0.0,
'thermal_zone additional_thermal_bridge_u_value is not none') 'thermal_zone additional_thermal_bridge_u_value is not 0.0')
self.assertIsNone(thermal_zone.effective_thermal_capacity, self.assertIsNone(thermal_zone.effective_thermal_capacity,
'thermal_zone effective_thermal_capacity is not none') 'thermal_zone effective_thermal_capacity is not none')
self.assertIsNone(thermal_zone.indirectly_heated_area_ratio, self.assertEqual(thermal_zone.indirectly_heated_area_ratio, 0.0,
'thermal_zone indirectly_heated_area_ratio is not none') 'thermal_zone indirectly_heated_area_ratio is not none')
self.assertIsNone(thermal_zone.infiltration_rate_system_off, self.assertIsNone(thermal_zone.infiltration_rate_system_off,
'thermal_zone infiltration_rate_system_off is not none') 'thermal_zone infiltration_rate_system_off is not none')
self.assertIsNone(thermal_zone.infiltration_rate_system_on, self.assertEqual(thermal_zone.infiltration_rate_system_on, 0.0,
'thermal_zone infiltration_rate_system_on is not none') 'thermal_zone infiltration_rate_system_on is not none')
self.assertIsNone(thermal_zone.usage_zones, self.assertIsNone(thermal_zone.usage_zones,
'thermal_zone usage_zones are not none') 'thermal_zone usage_zones are not none')
@ -168,14 +168,14 @@ class TestGeometryFactory(TestCase):
for thermal_zone in city_object.thermal_zones: for thermal_zone in city_object.thermal_zones:
for thermal_boundary in thermal_zone.bounded: for thermal_boundary in thermal_zone.bounded:
for thermal_opening in thermal_boundary.thermal_openings: 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.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.g_value, 'thermal_opening g_value was initialized')
self.assertIsNone(thermal_opening.conductivity, 'thermal_opening conductivity_w_mk 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, self.assertRaises(Exception, lambda: thermal_opening.openable_ratio,
'thermal_opening openable_ratio is not raising an exception') 'thermal_opening openable_ratio is not raising an exception')
self.assertIsNone(thermal_opening.outside_reflectance, self.assertIsNone(thermal_opening.front_side_solar_transmittance_at_normal_incidence,
'thermal_opening outside_reflectance was initialized') 'thermal_opening front_side_solar_transmittance_at_normal_incidence was initialized')
self.assertIsNone(thermal_opening.thickness, 'thermal_opening thickness_m 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') self.assertRaises(Exception, lambda: thermal_opening.u_value, 'thermal_opening u_value was initialized')

View File

@ -54,7 +54,5 @@ class TestPhysicsFactory(TestCase):
self.assertIsNotNone(thermal_zone.bounded, 'bounded is none') self.assertIsNotNone(thermal_zone.bounded, 'bounded is none')
for thermal_boundary in thermal_zone.bounded: for thermal_boundary in thermal_zone.bounded:
self.assertIsNotNone(thermal_boundary.outside_solar_absorptance, 'outside_solar_absorptance is none') 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.window_ratio, 'window_ratio is none')
self.assertIsNotNone(thermal_boundary.layers, 'layers is none') self.assertIsNotNone(thermal_boundary.layers, 'layers is none')