()
| 94 | |
| 95 | |
| 96 | def 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 | |
| 117 | def test_appendix_protection() -> None: |
nothing calls this directly
no test coverage detected