# Author: Simon-Pierre Boucher — simon-pierre.boucher@uqo.ca """Shared fixtures for the agent/debate tests: a hand-built packet (no data files) and a mock provider pool.""" from __future__ import annotations from datetime import date from pathlib import Path import pytest from agentic_valuation.agents.packets import build_packet from agentic_valuation.agents.runner import ProviderPool from agentic_valuation.providers import CostLedger from agentic_valuation.schemas import Comparable, GeoContext, MarketContext def make_row(**over): row = dict( tx_id="TST0000001", parcel_id="P1", date=date(2025, 5, 10), price=487123.0, street="12 rue Secrète", property_class="house", subtype="detached", region_name="Montréal", mun_name="MONT-01", mun_code="12345", borough_name=None, lat=45.5123456, lng=-73.6123456, floor_area_m2=140.0, land_area_m2=500.0, year_built=1975, storeys=1.0, n_units=1, roll_land_value=120000.0, roll_building_value=230000.0, roll_total_value=350000.0, roll_reference_date="2022-07-01", new_construction=False, ) row.update(over) return row def make_comps(n=6, cutoff=date(2025, 5, 9)): return [ Comparable( evidence_id=f"C{i + 1:02d}", sale_date=date(2025, 1, 1 + i), price=450000.0 + 10000 * i, distance_km=0.5 + 0.1 * i, property_class="house", municipality="MONT-01", floor_area_m2=130.0 + 5 * i, year_built=1970 + i, months_before_valuation=4.0 + 0.1 * i, price_per_m2=(450000.0 + 10000 * i) / (130.0 + 5 * i), ) for i in range(n) ] def make_market(): return MarketContext(as_of=date(2025, 5, 9), municipality_median_price_12m=470000.0, municipality_median_ppm2_12m=3400.0, municipality_n_sales_12m=120, region_yoy_change=0.03, local_liquidity_n_sales_3km_12m=40, local_median_assessment_ratio_12m=1.32) def make_geo(): return GeoContext(in_flood_zone=False, transit_stops_within_1km=12, da_population_density=4500.0, da_median_income=61000.0, distance_to_cbd_km=6.2, notes=["CBD reference: Montréal"]) @pytest.fixture def packet(): return build_packet(make_row(), make_comps(), make_market(), make_geo(), None) @pytest.fixture def pool(tmp_path: Path): return ProviderPool(CostLedger(tmp_path / "ledger.jsonl", cap_usd=1000.0, run_id="test"), force_mock=True)