MCPcopy Index your code
hub / github.com/microsoft/SkillOpt / test_appendix_module

Function test_appendix_module

tests/test_skill_aware_reflection.py:96–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95
96def test_appendix_module() -> None:
97 from skillopt.optimizer.appendix import (
98 has_appendix_field, inject_empty_appendix_field,
99 extract_appendix_notes, append_to_appendix_field, APPENDIX_START,
100 )
101 skill = "# QA Skill\n\n- Prefer shortest answer span."
102 s1 = inject_empty_appendix_field(skill)
103 assert has_appendix_field(s1) and extract_appendix_notes(s1) == []
104 assert inject_empty_appendix_field(s1) == s1 # idempotent
105 s2 = append_to_appendix_field(s1, ["Go to fridge for ice water.", "No stop token."])
106 assert extract_appendix_notes(s2) == ["Go to fridge for ice water.", "No stop token."]
107 s3 = append_to_appendix_field(s2, ["go to fridge for ice water", "Check sheet range."])
108 assert extract_appendix_notes(s3) == [
109 "Go to fridge for ice water.", "No stop token.", "Check sheet range.",
110 ], "near-duplicate must be dropped"
111 assert s3.count(APPENDIX_START) == 1, "exactly one region after accumulation"
112 assert "# QA Skill" in s3 and "Prefer shortest answer span" in s3
113 assert extract_appendix_notes(append_to_appendix_field(s1, [" ", "", "real"])) == ["real"]
114 print("PASS test_appendix_module")
115
116
117def test_appendix_protection() -> None:

Callers

nothing calls this directly

Calls 4

has_appendix_fieldFunction · 0.90
extract_appendix_notesFunction · 0.90
append_to_appendix_fieldFunction · 0.90

Tested by

no test coverage detected