SPB Git

spb/wp26_uqo

Public
2.3 KB · 53 lines python
1# Author: Simon-Pierre Boucher — simon-pierre.boucher@uqo.ca2"""Shared fixtures for the agent/debate tests: a hand-built packet (no data files) and a mock provider pool."""3from __future__ import annotations45from datetime import date6from pathlib import Path78import pytest910from agentic_valuation.agents.packets import build_packet11from agentic_valuation.agents.runner import ProviderPool12from agentic_valuation.providers import CostLedger13from agentic_valuation.schemas import Comparable, GeoContext, MarketContext141516def make_row(**over):17    row = dict(18        tx_id="TST0000001", parcel_id="P1", date=date(2025, 5, 10), price=487123.0, street="12 rue Secrète", property_class="house", subtype="detached",19        region_name="Montréal", mun_name="MONT-01", mun_code="12345", borough_name=None, lat=45.5123456, lng=-73.6123456,20        floor_area_m2=140.0, land_area_m2=500.0, year_built=1975, storeys=1.0, n_units=1,21        roll_land_value=120000.0, roll_building_value=230000.0, roll_total_value=350000.0, roll_reference_date="2022-07-01", new_construction=False,22    )23    row.update(over)24    return row252627def make_comps(n=6, cutoff=date(2025, 5, 9)):28    return [29        Comparable(30            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",31            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),32        )33        for i in range(n)34    ]353637def make_market():38    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)394041def make_geo():42    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"])434445@pytest.fixture46def packet():47    return build_packet(make_row(), make_comps(), make_market(), make_geo(), None)484950@pytest.fixture51def pool(tmp_path: Path):52    return ProviderPool(CostLedger(tmp_path / "ledger.jsonl", cap_usd=1000.0, run_id="test"), force_mock=True)53
Files · b780d9effbc0d688f848faf14e38219f6088143b
Menu

Theme