Support validated legacy portfolio composition
This commit is contained in:
@@ -36,3 +36,18 @@ def test_combine_specs_rejects_mismatched_resolution(tmp_path: Path) -> None:
|
||||
def test_combine_specs_rejects_incomplete_source(tmp_path: Path) -> None:
|
||||
with pytest.raises(ValueError, match="not complete"):
|
||||
combine_specs([write_spec(tmp_path / "one.json", "one", status="in_progress")])
|
||||
|
||||
|
||||
def test_combine_specs_accepts_populated_legacy_v1_when_dimensions_come_from_complete_spec(tmp_path: Path) -> None:
|
||||
legacy = tmp_path / "legacy.json"
|
||||
legacy.write_text(json.dumps({"schema_version": 1, "samples": [{"sample_slug": "legacy"}]}), encoding="utf-8")
|
||||
payload = combine_specs([legacy, write_spec(tmp_path / "current.json", "current")])
|
||||
assert payload["sample_count"] == 2
|
||||
assert payload["source_specs"][0]["source_status"] == "legacy_unstated"
|
||||
|
||||
|
||||
def test_combine_specs_rejects_empty_legacy_v1(tmp_path: Path) -> None:
|
||||
legacy = tmp_path / "legacy.json"
|
||||
legacy.write_text(json.dumps({"schema_version": 1, "samples": []}), encoding="utf-8")
|
||||
with pytest.raises(ValueError, match="not complete"):
|
||||
combine_specs([legacy, write_spec(tmp_path / "current.json", "current")])
|
||||
|
||||
Reference in New Issue
Block a user