Commit aa5d276
test: Add comprehensive unit tests for summarize module
Added 46 new tests for memdocs/summarize.py:
- TestSummarizerInit: API key, model, max_tokens initialization
- TestSummarizerRepr: Masked API key representation
- TestExtractYaml: YAML extraction from Claude responses
- TestBuildPrompt: Prompt construction with context
- TestBuildDocumentIndex: DocumentIndex building from YAML
- TestGenerateMarkdown: Markdown generation from DocumentIndex
- TestSummarize: Full summarization with mocked Claude API
- TestRateLimiting: Rate limiter behavior
- TestEdgeCases: Empty files, many symbols, special characters
Coverage improvements:
- summarize.py: 12% → 100% (+88%)
- security.py: 97% → 98%
- Overall: 79% → 85% (+6%)
Also fixed test_validate_path_runtime_error to work with Python 3.10+
by using MagicMock instead of Path subclass.
Total tests: 335 → 381 (+46 tests)
All tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent b25b20c commit aa5d276
2 files changed
+863
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | 102 | | |
104 | 103 | | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
112 | 111 | | |
113 | 112 | | |
114 | 113 | | |
| |||
0 commit comments