mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A re-lodged UPRN resolves to its latest historic certificate 🟩
Pins behaviour the exact-match slice already carried (max by lodgement_date; ISO dates sort lexicographically). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f9f80f7184
commit
ece4b736d9
1 changed files with 19 additions and 0 deletions
|
|
@ -130,6 +130,25 @@ def test_record_for_uprn_is_none_when_uprn_not_in_shard():
|
|||
assert HistoricEpcResolver(repo).record_for_uprn("999", "AB33 8AL") is None
|
||||
|
||||
|
||||
def test_record_for_uprn_picks_latest_lodgement_when_relodged():
|
||||
# Arrange — the register re-lodged this UPRN; the newer observation wins.
|
||||
repo = _FakeRepo(
|
||||
{
|
||||
"AB338AL": [
|
||||
_hist("47 GORDON ROAD", "100", lodgement_date="2008-01-15"),
|
||||
_hist("47 GORDON ROAD, DORRIDGE", "100", lodgement_date="2010-06-02"),
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
# Act
|
||||
record = HistoricEpcResolver(repo).record_for_uprn("100", "AB33 8AL")
|
||||
|
||||
# Assert
|
||||
assert record is not None
|
||||
assert record.lodgement_date == "2010-06-02"
|
||||
|
||||
|
||||
def test_resolve_uprn_is_none_when_all_scores_zero():
|
||||
# Arrange — no candidate shares the user's building number => all hard-zero.
|
||||
repo = _FakeRepo(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue