style(ingest): ruff format (I2)
This commit is contained in:
parent
dbf5dc5c13
commit
e66a2b4015
3 changed files with 32 additions and 7 deletions
|
|
@ -191,8 +191,7 @@ def read_csv(root: str | Path, query: str, *, max_rows: int) -> tuple[list[str],
|
||||||
)
|
)
|
||||||
if len(row) != len(header):
|
if len(row) != len(header):
|
||||||
raise IngestError(
|
raise IngestError(
|
||||||
f"ragged CSV row in {query!r}: expected {len(header)} cells, "
|
f"ragged CSV row in {query!r}: expected {len(header)} cells, got {len(row)}"
|
||||||
f"got {len(row)}"
|
|
||||||
)
|
)
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
return header, rows
|
return header, rows
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,20 @@ INGEST_SOURCE = REPO_ROOT / "src" / "portfolio_optimiser" / "ingest.py"
|
||||||
_INGESTED_AT = "2026-07-03T12:00:00Z"
|
_INGESTED_AT = "2026-07-03T12:00:00Z"
|
||||||
|
|
||||||
_EXTRACTIONS: list[dict[str, Any]] = [
|
_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 = {
|
_FILES = {
|
||||||
"costs.csv": b"item,cost\nled,120\n",
|
"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):
|
with pytest.raises(ValidationError):
|
||||||
materialize(manifest_path, bundle_dir, ingested_at=_INGESTED_AT)
|
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:
|
def test_reserved_filename_namespace_is_structurally_unreachable() -> None:
|
||||||
|
|
|
||||||
|
|
@ -255,8 +255,20 @@ def test_sql_source_has_no_connector_in_i2(tmp_path: Path) -> None:
|
||||||
# --- Step 4: index generation + stamped-replacement semantics ---
|
# --- Step 4: index generation + stamped-replacement semantics ---
|
||||||
|
|
||||||
_TWO_EXTRACTIONS = [
|
_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 = {
|
_TWO_FILES = {
|
||||||
"costs.csv": b"item,cost\nled,120\n",
|
"costs.csv": b"item,cost\nled,120\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue