mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Detect block-level asset conditions - additional test cases 🟥
This commit is contained in:
parent
a07020d085
commit
187d7fbadd
1 changed files with 41 additions and 28 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import Any
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from typing import Any
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from openpyxl import Workbook
|
from openpyxl import Workbook
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
@ -123,33 +123,46 @@ def test_peabody_parser_parses_conditions(peabody_assets_xlsx_bytes):
|
||||||
|
|
||||||
assert all(isinstance(item, PeabodyProperty) for item in result)
|
assert all(isinstance(item, PeabodyProperty) for item in result)
|
||||||
|
|
||||||
def test_peabody_asset_is_block_level():
|
@pytest.fixture
|
||||||
# arrange
|
def asset_condition_factory():
|
||||||
asset_condition = PeabodyAssetCondition(
|
def _factory(full_address: str) -> PeabodyAssetCondition:
|
||||||
lo_reference="",
|
return PeabodyAssetCondition(
|
||||||
full_address="1-80 PRINCESS ALICE HOUSE LONDON",
|
lo_reference="",
|
||||||
location_type_code=0,
|
full_address=full_address,
|
||||||
parent_lo_reference="",
|
location_type_code=0,
|
||||||
element_code=0,
|
parent_lo_reference="",
|
||||||
element="",
|
element_code=0,
|
||||||
sub_element_code=0,
|
element="",
|
||||||
sub_element="",
|
sub_element_code=0,
|
||||||
material_code=0,
|
sub_element="",
|
||||||
material_or_answer="",
|
material_code=0,
|
||||||
renewal_quantity=0,
|
material_or_answer="",
|
||||||
renewal_year=2026,
|
renewal_quantity=0,
|
||||||
cloned="",
|
renewal_year=2026,
|
||||||
lo_type_code=0,
|
cloned="",
|
||||||
renewal_cost=None,
|
lo_type_code=0,
|
||||||
condition_survey_date=None
|
renewal_cost=None,
|
||||||
)
|
condition_survey_date=None,
|
||||||
|
)
|
||||||
|
|
||||||
expected_block_level = True
|
return _factory
|
||||||
|
|
||||||
# act
|
@pytest.mark.parametrize(
|
||||||
actual_block_level = asset_condition.is_block_level
|
"full_address, expected_block_level",
|
||||||
|
[
|
||||||
|
("1-80 PRINCESS ALICE HOUSE LONDON", True),
|
||||||
|
("FLATS A-D 7 ST CHARLES SQUARE LONDON", True),
|
||||||
|
("9A-9H HEDGEGATE COURT LONDON", True),
|
||||||
|
("BLOCK MILNE HOUSE LONDON", True),
|
||||||
|
("25 HAVERSHAM COURT GREENFORD", False),
|
||||||
|
("FLAT 10 SPARROW COURT SOUTHMERE DRIVE LONDON SE2 9ES", False)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_peabody_asset_is_block_level(
|
||||||
|
asset_condition_factory,
|
||||||
|
full_address,
|
||||||
|
expected_block_level,
|
||||||
|
):
|
||||||
|
asset_condition = asset_condition_factory(full_address)
|
||||||
|
|
||||||
# assert
|
assert asset_condition.is_block_level == expected_block_level
|
||||||
assert expected_block_level == actual_block_level
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue