style(ingest): ruff format (I2)

This commit is contained in:
Kjell Tore Guttormsen 2026-07-03 18:40:40 +02:00
commit e66a2b4015
3 changed files with 32 additions and 7 deletions

View file

@ -191,8 +191,7 @@ def read_csv(root: str | Path, query: str, *, max_rows: int) -> tuple[list[str],
)
if len(row) != len(header):
raise IngestError(
f"ragged CSV row in {query!r}: expected {len(header)} cells, "
f"got {len(row)}"
f"ragged CSV row in {query!r}: expected {len(header)} cells, got {len(row)}"
)
rows.append(row)
return header, rows

View file

@ -53,8 +53,20 @@ INGEST_SOURCE = REPO_ROOT / "src" / "portfolio_optimiser" / "ingest.py"
_INGESTED_AT = "2026-07-03T12:00:00Z"
_EXTRACTIONS: list[dict[str, Any]] = [
{"id": "costs", "title": "Project costs", "query": "costs.csv", "okf_type": "dataset", "max_rows": 100},
{"id": "meta", "title": "Catalogue metadata", "query": "meta.csv", "okf_type": "reference", "max_rows": 10},
{
"id": "costs",
"title": "Project costs",
"query": "costs.csv",
"okf_type": "dataset",
"max_rows": 100,
},
{
"id": "meta",
"title": "Catalogue metadata",
"query": "meta.csv",
"okf_type": "reference",
"max_rows": 10,
},
]
_FILES = {
"costs.csv": b"item,cost\nled,120\n",
@ -95,7 +107,9 @@ def test_verdict_typed_manifest_is_rejected_and_writes_nothing(tmp_path: Path) -
with pytest.raises(ValidationError):
materialize(manifest_path, bundle_dir, ingested_at=_INGESTED_AT)
assert not bundle_dir.exists(), "a verdict-typed manifest must write NOTHING (no index, no files)"
assert not bundle_dir.exists(), (
"a verdict-typed manifest must write NOTHING (no index, no files)"
)
def test_reserved_filename_namespace_is_structurally_unreachable() -> None:

View file

@ -255,8 +255,20 @@ def test_sql_source_has_no_connector_in_i2(tmp_path: Path) -> None:
# --- Step 4: index generation + stamped-replacement semantics ---
_TWO_EXTRACTIONS = [
{"id": "costs", "title": "Project costs", "query": "costs.csv", "okf_type": "dataset", "max_rows": 100},
{"id": "meta", "title": "Catalogue metadata", "query": "meta.csv", "okf_type": "reference", "max_rows": 10},
{
"id": "costs",
"title": "Project costs",
"query": "costs.csv",
"okf_type": "dataset",
"max_rows": 100,
},
{
"id": "meta",
"title": "Catalogue metadata",
"query": "meta.csv",
"okf_type": "reference",
"max_rows": 10,
},
]
_TWO_FILES = {
"costs.csv": b"item,cost\nled,120\n",