from backend.ecmk_fetcher.xml_processor import parse_rdsap SAMPLE_XML = """
1 Fake Avenue Random AB24 5CD
0 Main Dwelling 25.31 2.46 43.61 0 26.16 2.44 42.33 0 4 2 100mm
""" def test_parse_rdsap_contract(): # arrange + act result = parse_rdsap(SAMPLE_XML) # assert assert result == { "address": "1, Fake Avenue, Random, AB24 5CD", "property_type": "House", "building_parts": [ { "identifier": "Main Dwelling", "floors": [ { "area_m2": 43.61, "height_m": 2.46, "heat_loss_perimeter_m": 25.31, "party_wall_length_m": 0.0, }, { "area_m2": 42.33, "height_m": 2.44, "heat_loss_perimeter_m": 26.16, "party_wall_length_m": 0.0, }, ], "roof": { "construction": 4, "insulation_location": 2, "insulation_thickness_mm": 100.0, }, } ], }