mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A shard with an unexpected extra column still maps to HistoricEpc 🟥
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ab245de68d
commit
55284a1807
1 changed files with 22 additions and 0 deletions
|
|
@ -144,6 +144,28 @@ def test_malformed_postcode_raises_postcode_not_found():
|
|||
repo.get_for_postcode(Postcode("NONSENSE"))
|
||||
|
||||
|
||||
def test_shard_with_unexpected_extra_column_still_maps():
|
||||
# Arrange — the upstream dump can gain columns the domain type doesn't
|
||||
# know; mapping must ignore them rather than explode at construction.
|
||||
buffer = StringIO()
|
||||
writer = csv.DictWriter(buffer, fieldnames=_COLS + ["SOMETHING_NEW"])
|
||||
writer.writeheader()
|
||||
row = {col: "" for col in _COLS}
|
||||
row["ADDRESS"] = "47 GORDON ROAD"
|
||||
row["UPRN"] = "100"
|
||||
row["SOMETHING_NEW"] = "surprise"
|
||||
writer.writerow(row)
|
||||
body = gzip.compress(buffer.getvalue().encode())
|
||||
repo = _repo(_FakeBoto(body=body))
|
||||
|
||||
# Act
|
||||
records = repo.get_for_postcode(Postcode("AB33 8AL"))
|
||||
|
||||
# Assert
|
||||
assert records[0].address == "47 GORDON ROAD"
|
||||
assert records[0].uprn == "100"
|
||||
|
||||
|
||||
def test_uprn_trailing_dot_zero_is_stripped():
|
||||
# Arrange — pandas reads an integer UPRN column written with a decimal as
|
||||
# float, so the cell stringifies to "151020766.0"; the domain UPRN must be
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue