SPlit up
Some checks failed
CI / Check (push) Failing after 1m58s
Build and publish Docker image / build-and-push (push) Failing after 1m5s

This commit is contained in:
Andras Schmelczer 2026-06-12 21:51:37 +01:00
parent cf39ad754e
commit f59d01227b
91 changed files with 10370 additions and 7562 deletions

View file

@ -1609,6 +1609,37 @@ def test_best_listing_match_numbered_query_cannot_subset_inflate_across_numbers(
assert result is None
def test_best_listing_match_letter_suffix_flats_do_not_cross_match() -> None:
# Regression: the gate uses fuzzy_join's suffix-aware tokens, so "8A" and
# "8B" are different numbers. Under the old digit-only tokens both looked
# like {8} and token_sort scored ~93, attaching the wrong flat's record
# whenever the true candidate was absent from the bucket.
candidates = [{"pp_address": "8B HIGH STREET"}]
result = _best_listing_match(
listing_uprn=None,
query="8A HIGH STREET",
uprn_index={},
bucket_candidates=candidates,
addressed_fields=["pp_address"],
)
assert result is None
def test_best_listing_match_building_listing_cannot_absorb_single_flat() -> None:
# Regression: set equality (not subset) over number tokens, so a whole-
# building listing "188 GREAT NORTH WAY" no longer matches "FLAT 1 188
# GREAT NORTH WAY" (token_set would have scored the pair 100).
candidates = [{"pp_address": "FLAT 1 188 GREAT NORTH WAY"}]
result = _best_listing_match(
listing_uprn=None,
query="188 GREAT NORTH WAY",
uprn_index={},
bucket_candidates=candidates,
addressed_fields=["pp_address"],
)
assert result is None
def test_finalize_listings_promotes_overlay_columns_and_filters_to_listing_rows() -> (
None
):