An oversized postcode becomes its own batch 🟩

Behavior emerged from the packing rule — pinned straight to green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-07 12:00:07 +00:00
parent 2dd948259f
commit 7606480338

View file

@ -28,3 +28,16 @@ def test_postcodes_are_never_split_across_batches() -> None:
in_batch = [p for p in batch if p.postcode == postcode]
everywhere = [p for p in properties if p.postcode == postcode]
assert len(in_batch) == len(everywhere) # whole postcode, one batch
def test_an_oversized_postcode_becomes_its_own_batch() -> None:
# arrange — one postcode alone exceeds the cap; neighbours are unaffected
properties = _properties("B93 8SU", 60, start_id=0) + _properties(
"M20 4TF", 20, start_id=100
)
# act
batches = pack_postcode_batches(properties, batch_size=50)
# assert
assert [len(b) for b in batches] == [60, 20]