mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
60 lines
2.2 KiB
Python
60 lines
2.2 KiB
Python
import pytest
|
|
from epc_data.attributes.WallAttributes import WallAttributes
|
|
from epc_data.tests.test_data.test_wall_attributes_cases import wall_cases
|
|
|
|
|
|
class TestWallAttributes:
|
|
|
|
@pytest.fixture
|
|
def wall_attr(self):
|
|
def _wall_attr(description):
|
|
return WallAttributes(description)
|
|
|
|
return _wall_attr
|
|
|
|
def test_thermal_transmittance(self, wall_attr):
|
|
description = 'average thermal transmittance -4.67 w/m-¦k'
|
|
wa = wall_attr(description)
|
|
result = wa.process()
|
|
assert result['thermal_transmittance'] == -4.67
|
|
assert result['thermal_transmittance_unit'] == 'w/m-¦k'
|
|
|
|
def test_wall_types(self, wall_attr):
|
|
description = 'solid brick system built'
|
|
wa = wall_attr(description)
|
|
result = wa.process()
|
|
assert result['is_solid_brick'] is True
|
|
assert result['is_system_built'] is True
|
|
assert result['is_timber_frame'] is False
|
|
|
|
def test_insulation_thickness(self, wall_attr):
|
|
description = 'additional insulation'
|
|
wa = wall_attr(description)
|
|
result = wa.process()
|
|
assert result['insulation_thickness'] == 'above average'
|
|
|
|
def test_insulation_type(self, wall_attr):
|
|
description = 'internal insulation'
|
|
wa = wall_attr(description)
|
|
result = wa.process()
|
|
assert result['internal_insulation'] is True
|
|
assert result['external_insulation'] is False
|
|
|
|
@pytest.mark.parametrize(
|
|
"test_case",
|
|
wall_cases
|
|
)
|
|
def test_wall_attributes(self, test_case):
|
|
expected_result = test_case.copy()
|
|
del expected_result["original_description"]
|
|
result = WallAttributes(test_case['original_description']).process()
|
|
assert set(result.keys()) == {
|
|
'is_as_built', 'is_assumed', 'is_sandstone_or_limestone', 'thermal_transmittance',
|
|
'is_cavity_wall', 'is_filled_cavity', 'is_system_built',
|
|
'external_insulation', 'is_solid_brick', 'is_timber_frame', 'internal_insulation',
|
|
'is_cob', 'is_granite_or_whinstone', 'insulation_thickness',
|
|
'thermal_transmittance_unit'
|
|
}
|
|
|
|
# Ensure the output ordering is correct
|
|
assert sorted(result.items()) == sorted(expected_result.items())
|