test(fase2a): repo-lokal mini-bundle-fixture for kryssprosjekt-læring (S2.0)
This commit is contained in:
parent
12e7f6aabc
commit
3497e64bdc
4 changed files with 92 additions and 0 deletions
|
|
@ -38,6 +38,28 @@ def test_every_project_has_docs_dir_and_verdict_input(projects: tuple[Project, .
|
|||
assert p.verdict_input["decision"] and p.verdict_input["rationale"]
|
||||
|
||||
|
||||
def test_repo_local_mini_bundle_loads_as_ir_projection() -> None:
|
||||
"""Step 1 (S2.0 fixture): the repo-local mini OKF-bundle under the package ``data/`` root loads
|
||||
as a valid IR projection via ``okf.load_ir_projection`` (fail-fast), exposing its ``project_id``,
|
||||
and lives under ``data/`` — NEVER under ``shared/`` (the subtree is PULL-ONLY). It is also a
|
||||
navigable OKF bundle (readable ``index.md``), so the Step-3 bundle-context navigation works."""
|
||||
import os
|
||||
from importlib.resources import files
|
||||
|
||||
from portfolio_optimiser import okf
|
||||
|
||||
bundle_dir = str(files("portfolio_optimiser").joinpath("data/bundles/bygg-energi-mikro-a"))
|
||||
assert os.path.isdir(bundle_dir)
|
||||
assert f"{os.sep}data{os.sep}bundles{os.sep}" in bundle_dir
|
||||
assert f"{os.sep}shared{os.sep}" not in bundle_dir
|
||||
|
||||
ir = okf.load_ir_projection(bundle_dir)
|
||||
assert ir["project_id"] == "BYGG-ENERGI-MIKRO-A"
|
||||
|
||||
bundle = okf.navigate_bundle(bundle_dir)
|
||||
assert bundle.index_summary.strip()
|
||||
|
||||
|
||||
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