|
12 | 12 | MILD_FIXTURE = Path("fixtures/coding_workflow_pr_review_mild_v1") |
13 | 13 | MODERATE_FIXTURE = Path("fixtures/coding_workflow_pr_review_moderate_v1") |
14 | 14 | NEG_FIXTURE = Path("fixtures/coding_workflow_pr_review_degraded_v1") |
| 15 | +INCIDENT_POS_FIXTURE = Path("fixtures/incident_response_page_triage_v1") |
| 16 | +INCIDENT_MILD_FIXTURE = Path("fixtures/incident_response_page_triage_mild_v1") |
| 17 | +INCIDENT_MODERATE_FIXTURE = Path("fixtures/incident_response_page_triage_moderate_v1") |
| 18 | +INCIDENT_NEG_FIXTURE = Path("fixtures/incident_response_page_triage_degraded_v1") |
15 | 19 | ARTIFACT_PATH = Path("artifacts/layered_admissibility_results.json") |
16 | 20 | CURVE_ID = "coding_workflow_pr_review_curve_v1" |
17 | 21 |
|
@@ -57,6 +61,74 @@ def test_layered_curve_fixtures_are_loaded_from_manifest_order() -> None: |
57 | 61 | NEG_FIXTURE.as_posix(), |
58 | 62 | ] |
59 | 63 |
|
| 64 | + |
| 65 | +def test_manifest_family_fixtures_for_coding_workflow_are_loaded_in_level_order() -> None: |
| 66 | + fixtures = DegradationCurveGenerator().fixtures_for_manifest_family("coding_workflow_pr_review") |
| 67 | + assert [fixture.as_posix() for fixture in fixtures] == [ |
| 68 | + POS_FIXTURE.as_posix(), |
| 69 | + MILD_FIXTURE.as_posix(), |
| 70 | + MODERATE_FIXTURE.as_posix(), |
| 71 | + NEG_FIXTURE.as_posix(), |
| 72 | + ] |
| 73 | + |
| 74 | + |
| 75 | +def test_manifest_family_fixtures_for_incident_response_are_loaded_in_level_order() -> None: |
| 76 | + fixtures = DegradationCurveGenerator().fixtures_for_manifest_family("incident_response_page_triage") |
| 77 | + assert [fixture.as_posix() for fixture in fixtures] == [ |
| 78 | + INCIDENT_POS_FIXTURE.as_posix(), |
| 79 | + INCIDENT_MILD_FIXTURE.as_posix(), |
| 80 | + INCIDENT_MODERATE_FIXTURE.as_posix(), |
| 81 | + INCIDENT_NEG_FIXTURE.as_posix(), |
| 82 | + ] |
| 83 | + |
| 84 | + |
| 85 | +def test_layered_curve_wrapper_remains_compatible_with_coding_workflow_family() -> None: |
| 86 | + generator = DegradationCurveGenerator() |
| 87 | + assert generator.fixtures_for_layered_admissibility_curve() == generator.fixtures_for_manifest_family( |
| 88 | + "coding_workflow_pr_review" |
| 89 | + ) |
| 90 | + |
| 91 | + |
| 92 | +def test_manifest_family_selection_missing_family_or_level_raises_value_error() -> None: |
| 93 | + generator = DegradationCurveGenerator() |
| 94 | + with pytest.raises(ValueError, match="missing fixtures for family 'nonexistent_family' levels"): |
| 95 | + generator.fixtures_for_manifest_family("nonexistent_family") |
| 96 | + |
| 97 | + with pytest.raises(ValueError, match="missing fixtures for family 'coding_workflow_pr_review' levels"): |
| 98 | + generator.fixtures_for_manifest_family("coding_workflow_pr_review", levels=("baseline", "unknown_level")) |
| 99 | + |
| 100 | + |
| 101 | +def test_manifest_family_selection_duplicate_level_raises_value_error(tmp_path: Path) -> None: |
| 102 | + manifest_path = tmp_path / "manifest.json" |
| 103 | + manifest_path.write_text( |
| 104 | + json.dumps( |
| 105 | + { |
| 106 | + "fixtures": [ |
| 107 | + { |
| 108 | + "fixture_id": "fixture_a", |
| 109 | + "family": "dup_family", |
| 110 | + "degradation_level": "baseline", |
| 111 | + "path": "fixtures/a", |
| 112 | + }, |
| 113 | + { |
| 114 | + "fixture_id": "fixture_b", |
| 115 | + "family": "dup_family", |
| 116 | + "degradation_level": "baseline", |
| 117 | + "path": "fixtures/b", |
| 118 | + }, |
| 119 | + ] |
| 120 | + } |
| 121 | + ), |
| 122 | + encoding="utf-8", |
| 123 | + ) |
| 124 | + |
| 125 | + with pytest.raises(ValueError, match="duplicate fixture for family 'dup_family' level 'baseline'"): |
| 126 | + DegradationCurveGenerator().fixtures_for_manifest_family( |
| 127 | + "dup_family", |
| 128 | + levels=("baseline",), |
| 129 | + manifest_path=manifest_path, |
| 130 | + ) |
| 131 | + |
60 | 132 | def test_to_dict_is_json_compatible_and_sorted() -> None: |
61 | 133 | generator = DegradationCurveGenerator() |
62 | 134 | curve = generator.generate(generator.fixtures_for_layered_admissibility_curve(), curve_id=CURVE_ID) |
|
0 commit comments