From e66a2b40151f04da381f8f707ca70d25604ab71b Mon Sep 17 00:00:00 2001 From: Kjell Tore Guttormsen Date: Fri, 3 Jul 2026 18:40:40 +0200 Subject: [PATCH] style(ingest): ruff format (I2) --- src/portfolio_optimiser/ingest.py | 3 +-- tests/test_ingest_loadbearing.py | 20 +++++++++++++++++--- tests/test_ingest_materialize.py | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/portfolio_optimiser/ingest.py b/src/portfolio_optimiser/ingest.py index 02fa2c8..948385c 100644 --- a/src/portfolio_optimiser/ingest.py +++ b/src/portfolio_optimiser/ingest.py @@ -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 diff --git a/tests/test_ingest_loadbearing.py b/tests/test_ingest_loadbearing.py index 80cde0b..4519f9a 100644 --- a/tests/test_ingest_loadbearing.py +++ b/tests/test_ingest_loadbearing.py @@ -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: diff --git a/tests/test_ingest_materialize.py b/tests/test_ingest_materialize.py index 399b199..566142e 100644 --- a/tests/test_ingest_materialize.py +++ b/tests/test_ingest_materialize.py @@ -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",