Generate property reference to uprn map from csv bytes 🟥

This commit is contained in:
Daniel Roth 2026-02-04 11:23:30 +00:00
parent dd31c2d945
commit b143169659
4 changed files with 42 additions and 14 deletions

View file

@ -0,0 +1,9 @@
from typing import BinaryIO, Dict
from backend.condition.lookups.uprn_lookup import UprnLookup
class UprnLookupCsv(UprnLookup):
def get_location_ref_to_uprn_map(
self, lookup_file_stream: BinaryIO
) -> Dict[str, int]:
raise NotImplementedError

View file

@ -1,7 +0,0 @@
from typing import Dict
from backend.condition.lookups.uprn_lookup import UprnLookup
class UprnLookupLocal(UprnLookup):
def get_location_ref_to_uprn_map(self, lookup_filepath: str) -> Dict[str, int]:
raise NotImplementedError

View file

@ -1,7 +0,0 @@
from typing import Dict
from backend.condition.lookups.uprn_lookup import UprnLookup
class UprnLookupS3(UprnLookup):
def get_location_ref_to_uprn_map(self, lookup_filepath: str) -> Dict[str, int]:
raise NotImplementedError

View file

@ -0,0 +1,33 @@
from typing import Any, Dict
import pytest
from io import BytesIO
from backend.condition.lookups.uprn_lookup_csv import UprnLookupCsv
@pytest.fixture
def prop_ref_uprn_csv_bytes() -> BytesIO:
csv_bytes = b"""reference, out_uprn
ABC123,10000000001
DEF456,10000000002
GHI789,10000000003
"""
return BytesIO(csv_bytes)
def test_generate_prop_ref_uprn_from_csv_bytes(prop_ref_uprn_csv_bytes) -> None:
# arrange
uprn_lookup = UprnLookupCsv()
expected_map: Dict[str, int] = {
"ABC123": 10000000001,
"DEF456": 10000000002,
"GHI789": 10000000003,
}
# act
actual_map: Dict[str, int] = uprn_lookup.get_location_ref_to_uprn_map(
prop_ref_uprn_csv_bytes
)
# assert
assert actual_map == expected_map