MCPcopy Create free account
hub / github.com/microsoft/SkillOpt / test_appendix_protection

Function test_appendix_protection

tests/test_skill_aware_reflection.py:117–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116
117def 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
135def test_coexistence_with_slow_update() -> None:

Callers

nothing calls this directly

Calls 3

append_to_appendix_fieldFunction · 0.90
_apply_edit_with_reportFunction · 0.90

Tested by

no test coverage detected