mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Filters combine with AND 🟩
Behavior emerged from filter composition — pinned straight to green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
fc3f6a6f94
commit
513977a6fd
1 changed files with 24 additions and 0 deletions
|
|
@ -287,6 +287,30 @@ def test_built_form_filter_resolves_with_the_same_precedence(
|
|||
assert [p.property_id for p in resolved] == [overridden, mid_terrace]
|
||||
|
||||
|
||||
def test_filters_combine_with_and(db_engine: Engine) -> None:
|
||||
# arrange — right postcode + right type, right postcode + wrong type,
|
||||
# wrong postcode + right type
|
||||
with Session(db_engine) as session:
|
||||
match = _seed_property(session, portfolio_id=814, postcode="B93 8SU")
|
||||
_seed_epc(session, property_id=match, property_type="House")
|
||||
wrong_type = _seed_property(session, portfolio_id=814, postcode="B93 8SU")
|
||||
_seed_epc(session, property_id=wrong_type, property_type="Flat")
|
||||
wrong_postcode = _seed_property(session, portfolio_id=814, postcode="M20 4TF")
|
||||
_seed_epc(session, property_id=wrong_postcode, property_type="House")
|
||||
|
||||
# act
|
||||
resolved = resolve_filtered_property_ids(
|
||||
session,
|
||||
portfolio_id=814,
|
||||
filters=PropertyGroupFilters(
|
||||
postcodes=["B93 8SU"], property_types=["House"]
|
||||
),
|
||||
)
|
||||
|
||||
# assert
|
||||
assert [p.property_id for p in resolved] == [match]
|
||||
|
||||
|
||||
def test_postcode_filter_matches_exactly(db_engine: Engine) -> None:
|
||||
# arrange
|
||||
with Session(db_engine) as session:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue