()
| 115 | |
| 116 | |
| 117 | def test_appendix_protection() -> None: |
| 118 | from skillopt.optimizer.skill import _apply_edit_with_report |
| 119 | from skillopt.optimizer.appendix import append_to_appendix_field, inject_empty_appendix_field |
| 120 | |
| 121 | skill = inject_empty_appendix_field("# QA Skill\n\n- Rule one.") |
| 122 | skill = append_to_appendix_field(skill, ["Follow rule one before acting."]) |
| 123 | for e in ( |
| 124 | {"op": "delete", "target": "Follow rule one before acting."}, |
| 125 | {"op": "replace", "target": "Follow rule one before acting.", "content": "HACK"}, |
| 126 | ): |
| 127 | new, rep = _apply_edit_with_report(skill, e) |
| 128 | assert new == skill, f"appendix must be protected from {e['op']}" |
| 129 | assert rep["status"] == "skipped_protected_region" |
| 130 | new, rep = _apply_edit_with_report(skill, {"op": "replace", "target": "Rule one.", "content": "Rule 1."}) |
| 131 | assert "Rule 1." in new and "Follow rule one before acting." in new |
| 132 | print("PASS test_appendix_protection") |
| 133 | |
| 134 | |
| 135 | def test_coexistence_with_slow_update() -> None: |
nothing calls this directly
no test coverage detected