mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
More complicated XML test 🟥
This commit is contained in:
parent
50e2ef457e
commit
8f8f6f1a1a
1 changed files with 66 additions and 19 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from backend.ecmk_fetcher.xml_processor import parse_rdsap
|
||||
from backend.ecmk_fetcher.xml_processor import SapPropertyDetails, parse_rdsap
|
||||
|
||||
|
||||
SAMPLE_XML = """<RdSAP-Report xmlns="https://epbr.digital.communities.gov.uk/xsd/rdsap">
|
||||
|
|
@ -18,29 +18,64 @@ SAMPLE_XML = """<RdSAP-Report xmlns="https://epbr.digital.communities.gov.uk/xsd
|
|||
<Property-Type>0</Property-Type>
|
||||
|
||||
<SAP-Building-Parts>
|
||||
|
||||
<SAP-Building-Part>
|
||||
<Building-Part-Number>1</Building-Part-Number>
|
||||
<Identifier>Main Dwelling</Identifier>
|
||||
|
||||
<SAP-Floor-Dimensions>
|
||||
<SAP-Floor-Dimension>
|
||||
<Heat-Loss-Perimeter>25.31</Heat-Loss-Perimeter>
|
||||
<Room-Height>2.46</Room-Height>
|
||||
<Total-Floor-Area>43.61</Total-Floor-Area>
|
||||
<Party-Wall-Length>0</Party-Wall-Length>
|
||||
</SAP-Floor-Dimension>
|
||||
|
||||
<SAP-Floor-Dimension>
|
||||
<Heat-Loss-Perimeter>26.16</Heat-Loss-Perimeter>
|
||||
<Room-Height>2.44</Room-Height>
|
||||
<Total-Floor-Area>42.33</Total-Floor-Area>
|
||||
<Party-Wall-Length>0</Party-Wall-Length>
|
||||
</SAP-Floor-Dimension>
|
||||
</SAP-Floor-Dimensions>
|
||||
<Construction-Age-Band>C</Construction-Age-Band>
|
||||
<Floor-Heat-Loss>7</Floor-Heat-Loss>
|
||||
|
||||
<Roof-Construction>4</Roof-Construction>
|
||||
<Roof-Insulation-Location>2</Roof-Insulation-Location>
|
||||
<Roof-Insulation-Thickness>100mm</Roof-Insulation-Thickness>
|
||||
|
||||
<Wall-Construction>4</Wall-Construction>
|
||||
<Wall-Insulation-Type>4</Wall-Insulation-Type>
|
||||
|
||||
<SAP-Floor-Dimensions>
|
||||
<SAP-Floor-Dimension>
|
||||
<Heat-Loss-Perimeter quantity="metres">25.31</Heat-Loss-Perimeter>
|
||||
<Room-Height quantity="metres">2.46</Room-Height>
|
||||
<Total-Floor-Area quantity="square metres">43.61</Total-Floor-Area>
|
||||
<Floor>0</Floor>
|
||||
<Party-Wall-Length>0</Party-Wall-Length>
|
||||
</SAP-Floor-Dimension>
|
||||
|
||||
<SAP-Floor-Dimension>
|
||||
<Heat-Loss-Perimeter quantity="metres">26.16</Heat-Loss-Perimeter>
|
||||
<Room-Height quantity="metres">2.44</Room-Height>
|
||||
<Total-Floor-Area quantity="square metres">42.33</Total-Floor-Area>
|
||||
<Floor>1</Floor>
|
||||
<Party-Wall-Length>0</Party-Wall-Length>
|
||||
</SAP-Floor-Dimension>
|
||||
</SAP-Floor-Dimensions>
|
||||
|
||||
</SAP-Building-Part>
|
||||
|
||||
<SAP-Building-Part>
|
||||
<Building-Part-Number>2</Building-Part-Number>
|
||||
<Identifier>Extension</Identifier>
|
||||
<Construction-Age-Band>C</Construction-Age-Band>
|
||||
|
||||
<Roof-Construction>8</Roof-Construction>
|
||||
<Roof-Insulation-Location>7</Roof-Insulation-Location>
|
||||
<Sloping-Ceiling-Insulation-Thickness>AB</Sloping-Ceiling-Insulation-Thickness>
|
||||
|
||||
<Wall-Construction>3</Wall-Construction>
|
||||
<Wall-Insulation-Type>4</Wall-Insulation-Type>
|
||||
|
||||
<SAP-Floor-Dimensions>
|
||||
<SAP-Floor-Dimension>
|
||||
<Heat-Loss-Perimeter quantity="metres">6.85</Heat-Loss-Perimeter>
|
||||
<Room-Height quantity="metres">2.24</Room-Height>
|
||||
<Total-Floor-Area quantity="square metres">4.46</Total-Floor-Area>
|
||||
<Floor>0</Floor>
|
||||
<Party-Wall-Length>0</Party-Wall-Length>
|
||||
</SAP-Floor-Dimension>
|
||||
</SAP-Floor-Dimensions>
|
||||
|
||||
</SAP-Building-Part>
|
||||
|
||||
</SAP-Building-Parts>
|
||||
|
||||
</SAP-Property-Details>
|
||||
|
|
@ -51,7 +86,7 @@ SAMPLE_XML = """<RdSAP-Report xmlns="https://epbr.digital.communities.gov.uk/xsd
|
|||
|
||||
def test_parse_rdsap_contract():
|
||||
# arrange + act
|
||||
result = parse_rdsap(SAMPLE_XML)
|
||||
result: SapPropertyDetails = parse_rdsap(SAMPLE_XML)
|
||||
|
||||
# assert
|
||||
assert result == {
|
||||
|
|
@ -79,6 +114,18 @@ def test_parse_rdsap_contract():
|
|||
"insulation_location": 2,
|
||||
"insulation_thickness_mm": 100.0,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"identifier": "Extension",
|
||||
"floors": [
|
||||
{
|
||||
"area_m2": 4.46,
|
||||
"height_m": 2.24,
|
||||
"heat_loss_perimeter_m": 6.85,
|
||||
"party_wall_length_m": 0.0,
|
||||
}
|
||||
],
|
||||
"roof": None,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue