test(tradein): estimator pure-helper unit tests + fix None crash in _filter_outliers (#580) #640

Merged
Light1YT merged 1 commit from test/580-estimator-pure-units into main 2026-05-29 08:24:19 +00:00

1 commit

Author SHA1 Message Date
47329a3adb test(tradein): unit-cover estimator pure helpers + fix None crash in _filter_outliers (#580)
_filter_outliers used lot.get("price_per_m2", 0), whose default only applies
when the key is absent; a present-but-None value (listings.price_per_m2 is
nullable) leaked into `low <= None <= high` → TypeError, crashing the estimate.
Make the bounds check None-safe: keep unpriced lots, still drop genuine priced
outliers. Behavior byte-identical for all real prices (incl. 0).

Add tests/test_estimator_pure_units.py (23 tests) covering _percentile,
_filter_outliers (incl. the None regression) and _compute_confidence
(thresholds, concentration downgrade, fallback notes).

Closes #580
2026-05-29 13:17:33 +05:00