Exclude lists always applied when non-empty.
| 49 | |
| 50 | |
| 51 | class TestTargetingEngineExclusions: |
| 52 | """Exclude lists always applied when non-empty.""" |
| 53 | |
| 54 | def test_exclude_advertiser_ids_adds_must_not(self): |
| 55 | vf = _build_filter(exclude_advertiser_ids=["bad-adv"]) |
| 56 | adv_filters = [f for f in vf.must_not if f.field == "advertiser_id"] |
| 57 | assert len(adv_filters) == 1 |
| 58 | assert adv_filters[0].op == FilterOp.not_in |
| 59 | assert adv_filters[0].value == ["bad-adv"] |
| 60 | |
| 61 | def test_exclude_ad_ids_adds_must_not(self): |
| 62 | vf = _build_filter(exclude_ad_ids=["bad-ad-1"]) |
| 63 | ad_filters = [f for f in vf.must_not if f.field == "ad_id"] |
| 64 | assert len(ad_filters) == 1 |
| 65 | assert ad_filters[0].op == FilterOp.not_in |
| 66 | assert ad_filters[0].value == ["bad-ad-1"] |
| 67 | |
| 68 | def test_both_exclusions_when_provided(self): |
| 69 | vf = _build_filter( |
| 70 | exclude_advertiser_ids=["adv-1"], |
| 71 | exclude_ad_ids=["ad-1", "ad-2"], |
| 72 | ) |
| 73 | assert len(vf.must_not) == 2 |
| 74 | |
| 75 | |
| 76 | class TestTargetingEngineEmptyConstraints: |
nothing calls this directly
no outgoing calls
no test coverage detected