improve unit tests and bug fix

This commit is contained in:
Guille Gutierrez 2023-07-10 15:03:04 -04:00
parent af93dbb3a1
commit 8839cf07c2
3 changed files with 12 additions and 105129 deletions

File diff suppressed because it is too large Load Diff

View File

@ -94,17 +94,16 @@ class TestCityMerge(TestCase):
surface.global_irradiance[cte.YEAR] = pd.DataFrame([3], columns=['sra_mockup_value'])
merged_city = full_city.merge(even_city)
merged_city_building_total_radiation = 0
first_merged_city_building_total_radiation = 0
for building in merged_city.buildings:
for surface in building.surfaces:
if surface.global_irradiance:
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
self.assertEqual(189336013, merged_city_building_total_radiation)
first_merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
merged_city = even_city.merge(full_city)
merged_city_building_total_radiation = 0
second_merged_city_building_total_radiation = 0
for building in merged_city.buildings:
for surface in building.surfaces:
if surface.global_irradiance:
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
self.assertEqual(189336013, merged_city_building_total_radiation)
second_merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
self.assertEqual(first_merged_city_building_total_radiation, second_merged_city_building_total_radiation)

View File

@ -5,7 +5,7 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import logging.handlers
from pathlib import Path
from unittest import TestCase
import pandas as pd
@ -66,7 +66,12 @@ class TestExports(TestCase):
def _export(self, export_type, from_pickle=False):
self._complete_city = self._get_complete_city(from_pickle)
ExportsFactory(export_type, self._complete_city, self._output_path).export()
try:
ExportsFactory(export_type, self._complete_city, self._output_path).export()
except ValueError as err:
if export_type != '_stl':
logging.warning('No backend export for STL test, skipped')
raise err
def _export_building_energy(self, export_type, from_pickle=False):
self._complete_city = self._get_complete_city(from_pickle)