From bea5901bc280e4f931a06650d07f49a4856fd459 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 15 May 2025 16:25:05 +0100 Subject: [PATCH] Added year built test --- etl/epc/tests/test_epcrecord.py | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/etl/epc/tests/test_epcrecord.py b/etl/epc/tests/test_epcrecord.py index cf0361b1..37a00cd4 100644 --- a/etl/epc/tests/test_epcrecord.py +++ b/etl/epc/tests/test_epcrecord.py @@ -356,3 +356,64 @@ class TestEpcRecord: assert record.prepared_epc["solar-water-heating-flag"] == "N" assert record.solar_water_heating_flag_bool is False + + def test_year_built(self, cleaning_data): + # This test handles a specific test case + # Mock the property object + + epc_records = { + "original_epc": { + 'low-energy-fixed-light-count': '', 'address': '19 Waterloo Road, Shoeburyness', + 'uprn-source': 'Energy Assessor', 'floor-height': '2.65', 'heating-cost-potential': '436', + 'unheated-corridor-length': '', 'hot-water-cost-potential': '100', + 'construction-age-band': 'England and Wales: 1900-1929', 'potential-energy-rating': 'B', + 'mainheat-energy-eff': 'Good', 'windows-env-eff': 'Good', 'lighting-energy-eff': 'Very Good', + 'environment-impact-potential': '89', 'glazed-type': 'double glazing installed during or after 2002', + 'heating-cost-current': '888', 'address3': '', + 'mainheatcont-description': 'Programmer and room thermostat', + 'sheating-energy-eff': 'N/A', 'report-type': '100', 'property-type': 'House', + 'local-authority-label': 'Southend-on-Sea', 'fixed-lighting-outlets-count': '9', + 'energy-tariff': 'Single', + 'mechanical-ventilation': 'natural', 'hot-water-cost-current': '386', 'county': '', + 'postcode': 'SS3 9EQ', + 'solar-water-heating-flag': 'N', 'constituency': 'E14001501', 'co2-emissions-potential': '0.7', + 'number-heated-rooms': '4', 'floor-description': 'Suspended, no insulation (assumed)', + 'energy-consumption-potential': '49', 'local-authority': 'E06000033', 'built-form': 'Mid-Terrace', + 'number-open-fireplaces': '0', 'windows-description': 'Fully double glazed', 'glazed-area': 'Normal', + 'inspection-date': '2025-03-17', 'mains-gas-flag': 'Y', 'co2-emiss-curr-per-floor-area': '58', + 'address1': '19 Waterloo Road', 'heat-loss-corridor': '', 'flat-storey-count': '', + 'constituency-label': '', + 'roof-energy-eff': 'Average', 'total-floor-area': '78.0', 'building-reference-number': '10007286268', + 'environment-impact-current': '48', 'co2-emissions-current': '4.5', + 'roof-description': 'Pitched, 100 mm loft insulation', 'floor-energy-eff': 'N/A', + 'number-habitable-rooms': '4', 'address2': 'Shoeburyness', 'hot-water-env-eff': 'Average', + 'posttown': 'SOUTHEND-ON-SEA', 'mainheatc-energy-eff': 'Average', + 'main-fuel': 'mains gas (not community)', + 'lighting-env-eff': 'Very Good', 'windows-energy-eff': 'Good', 'floor-env-eff': 'N/A', + 'sheating-env-eff': 'N/A', 'lighting-description': 'Low energy lighting in 78% of fixed outlets', + 'roof-env-eff': 'Average', 'walls-energy-eff': 'Very Poor', 'photo-supply': '0.0', + 'lighting-cost-potential': '101', 'mainheat-env-eff': 'Good', 'multi-glaze-proportion': '100', + 'main-heating-controls': '', 'lodgement-datetime': '2025-03-25 16:59:15', 'flat-top-storey': '', + 'current-energy-rating': 'D', 'secondheat-description': 'None', 'walls-env-eff': 'Very Poor', + 'transaction-type': 'marketed sale', 'uprn': 100090702270, 'current-energy-efficiency': '56', + 'energy-consumption-current': '329', 'mainheat-description': 'Boiler and radiators, mains gas', + 'lighting-cost-current': '101', 'lodgement-date': '2025-03-25', 'extension-count': '1', + 'mainheatc-env-eff': 'Average', + 'lmk-key': 'ff00a1e150063f7bbcac1644be57fdcf05b6c9c60053f80c5d218bf2863fea93', + 'wind-turbine-count': '0', + 'tenure': 'Owner-occupied', 'floor-level': '', 'potential-energy-efficiency': '89', + 'hot-water-energy-eff': 'Average', 'low-energy-lighting': '78', + 'walls-description': 'Solid brick, as built, no insulation (assumed)', + 'hotwater-description': 'From main system' + }, + "full_sap_epc": {}, + "old_data": [] + } + + prepared_epc = EPCRecord( + epc_records=epc_records, + run_mode="newdata", + cleaning_data=cleaning_data + ) + + assert prepared_epc.get("year_built") == 1900