test(fase2a): commit Step 2 optional bundle_dir/verdict_dir tests (S2.0, omitted from 9659045)
This commit is contained in:
parent
73c24fc69a
commit
7978bd5f49
1 changed files with 27 additions and 0 deletions
|
|
@ -60,6 +60,33 @@ def test_repo_local_mini_bundle_loads_as_ir_projection() -> None:
|
|||
assert bundle.index_summary.strip()
|
||||
|
||||
|
||||
def test_existing_projects_have_null_bundle_and_verdict_dir(projects: tuple[Project, ...]) -> None:
|
||||
"""Step 2 (S2.0 schema): the shipped reference_projects.json is UNCHANGED this bolk, so every
|
||||
existing row loads with ``bundle_dir is None`` AND ``verdict_dir is None`` — no ``KeyError`` (the
|
||||
loader reads both via ``p.get(...)``, backward-compatible). Removing either field reddens this."""
|
||||
for p in projects:
|
||||
assert p.bundle_dir is None
|
||||
assert p.verdict_dir is None
|
||||
|
||||
|
||||
def test_project_accepts_optional_bundle_and_verdict_dir() -> None:
|
||||
"""Step 2 (S2.0 schema): the frozen Project exposes optional ``bundle_dir`` + ``verdict_dir``
|
||||
fields a caller can set directly — the concrete sources Step 3 threads through run_portfolio."""
|
||||
p = Project(
|
||||
id="X",
|
||||
name="x",
|
||||
description="d",
|
||||
currency="NOK",
|
||||
cost_items=(),
|
||||
docs_dir="/tmp/x",
|
||||
verdict_input={"decision": "approved", "rationale": "r"},
|
||||
bundle_dir="/tmp/bundle",
|
||||
verdict_dir="/tmp/inbox",
|
||||
)
|
||||
assert p.bundle_dir == "/tmp/bundle"
|
||||
assert p.verdict_dir == "/tmp/inbox"
|
||||
|
||||
|
||||
def test_cost_item_total_is_quantity_times_unit_cost() -> None:
|
||||
item = CostItem(code="X", description="d", quantity=4.0, unit="m2", unit_cost=215.0)
|
||||
assert item.total_cost == pytest.approx(860.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue