mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-19 17:03:02 +00:00
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:
parent
2dd948259f
commit
7606480338
1 changed files with 13 additions and 0 deletions
|
|
@ -28,3 +28,16 @@ def test_postcodes_are_never_split_across_batches() -> None:
|
||||||
in_batch = [p for p in batch if p.postcode == postcode]
|
in_batch = [p for p in batch if p.postcode == postcode]
|
||||||
everywhere = [p for p in properties if p.postcode == postcode]
|
everywhere = [p for p in properties if p.postcode == postcode]
|
||||||
assert len(in_batch) == len(everywhere) # whole postcode, one batch
|
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]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue