all tests passed

This commit is contained in:
Pilar Monsalvete 2023-08-03 17:00:59 -04:00
parent 212b4b0621
commit 1e9afa28a8
6 changed files with 11 additions and 11 deletions

View File

@ -264,7 +264,10 @@ class Building(CityObject):
for internal_zone in self.internal_zones: for internal_zone in self.internal_zones:
self._average_storey_height += internal_zone.mean_height / len(self.internal_zones) self._average_storey_height += internal_zone.mean_height / len(self.internal_zones)
else: else:
self._average_storey_height = self.internal_zones[0].thermal_archetype.average_storey_height if self.internal_zones[0].thermal_archetype is None:
self._average_storey_height = None
else:
self._average_storey_height = self.internal_zones[0].thermal_archetype.average_storey_height
return self._average_storey_height return self._average_storey_height
@average_storey_height.setter @average_storey_height.setter

View File

@ -38,7 +38,7 @@ class ThermalBoundary:
self._thickness = None self._thickness = None
self._internal_surface = None self._internal_surface = None
self._external_surface = None self._external_surface = None
self._window_ratio = None self._window_ratio = 0
self._window_ratio_to_be_calculated = False self._window_ratio_to_be_calculated = False
if self._windows_areas is not None: if self._windows_areas is not None:
self._window_ratio_to_be_calculated = True self._window_ratio_to_be_calculated = True

View File

@ -10,7 +10,6 @@ from unittest import TestCase
from hub.imports.geometry_factory import GeometryFactory from hub.imports.geometry_factory import GeometryFactory
from hub.imports.construction_factory import ConstructionFactory from hub.imports.construction_factory import ConstructionFactory
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
import hub.helpers.constants as cte
class TestConstructionFactory(TestCase): class TestConstructionFactory(TestCase):
@ -139,10 +138,7 @@ class TestConstructionFactory(TestCase):
self.assertIsNotNone(thermal_boundary.thickness, 'thermal_boundary thickness is none') self.assertIsNotNone(thermal_boundary.thickness, 'thermal_boundary thickness is none')
self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none') self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none')
self.assertIsNotNone(thermal_boundary.thermal_openings, 'thermal_openings is none') self.assertIsNotNone(thermal_boundary.thermal_openings, 'thermal_openings is none')
if thermal_boundary.type in (cte.WALL, cte.ROOF): self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none')
self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none')
else:
self.assertIsNone(thermal_boundary.window_ratio, 'window_ratio is not none')
self.assertIsNone(thermal_boundary.windows_areas, 'windows_areas is not none') self.assertIsNone(thermal_boundary.windows_areas, 'windows_areas is not none')
self.assertIsNotNone(thermal_boundary.u_value, 'u_value is none') self.assertIsNotNone(thermal_boundary.u_value, 'u_value is none')
self.assertIsNotNone(thermal_boundary.hi, 'hi is none') self.assertIsNotNone(thermal_boundary.hi, 'hi is none')

View File

@ -128,11 +128,12 @@ class TestExports(TestCase):
for thermal_boundary in thermal_zone.thermal_boundaries: for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.type) self.assertIsNotNone(thermal_boundary.type)
self.assertIsNotNone(thermal_boundary.opaque_area) self.assertIsNotNone(thermal_boundary.opaque_area)
self.assertIsNotNone(thermal_boundary.window_ratio) if thermal_boundary.type in (cte.WALL, cte.ROOF):
self.assertIsNotNone(thermal_boundary.window_ratio)
self.assertIsNotNone(thermal_boundary.u_value) self.assertIsNotNone(thermal_boundary.u_value)
self.assertIsNotNone(thermal_boundary.thermal_openings) self.assertIsNotNone(thermal_boundary.thermal_openings)
if thermal_boundary.type is not cte.GROUND: if thermal_boundary.type is not cte.GROUND:
self.assertIsNotNone(thermal_boundary.parent_surface.short_wave_reflectance) self.assertIsNotNone(thermal_boundary.external_surface.short_wave_reflectance)
for usage in internal_zone.usages: for usage in internal_zone.usages:
self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none') self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none')

View File

@ -62,7 +62,7 @@ class TestGeometryFactory(TestCase):
self.assertIsNotNone(building.internal_zones, 'building internal zones is none') self.assertIsNotNone(building.internal_zones, 'building internal zones is none')
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
self.assertIsNone(internal_zone.usages, 'usage zones are defined') self.assertIsNone(internal_zone.usages, 'usage zones are defined')
self.assertIsNone(internal_zone.thermal_zones_from_internal_zones, 'thermal zones are defined') self.assertIsNone(internal_zone.thermal_archetype, 'thermal archetype is defined')
self.assertIsNone(building.basement_heated, 'building basement_heated is not none') self.assertIsNone(building.basement_heated, 'building basement_heated is not none')
self.assertIsNone(building.attic_heated, 'building attic_heated is not none') self.assertIsNone(building.attic_heated, 'building attic_heated is not none')
self.assertIsNone(building.terrains, 'building terrains is not none') self.assertIsNone(building.terrains, 'building terrains is not none')

View File

@ -132,7 +132,7 @@ class TestExports(TestCase):
self.assertIsNotNone(thermal_boundary.u_value) self.assertIsNotNone(thermal_boundary.u_value)
self.assertIsNotNone(thermal_boundary.thermal_openings) self.assertIsNotNone(thermal_boundary.thermal_openings)
if thermal_boundary.type is not cte.GROUND: if thermal_boundary.type is not cte.GROUND:
self.assertIsNotNone(thermal_boundary.parent_surface.short_wave_reflectance) self.assertIsNotNone(thermal_boundary.external_surface.short_wave_reflectance)
for usage in internal_zone.usages: for usage in internal_zone.usages:
self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none') self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none')