Add unit test coverage for pure helpers in ai.py #55
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ai.pyis documented as exempt from unit testing because it requires a live Anthropic API. But several helpers inai.pyare pure functions that have nothing to do with the API and could be tested without any mocking:_filter_dir_tools(survey)—ai.py:824— tool list filtering by survey confidence_format_survey_block(survey)—ai.py:803— survey dict → text block_format_survey_signals(signals)—ai.py:1021— signals dict → text block_default_survey()—ai.py:784— synthetic skip survey_should_skip_dir(name)—ai.py:80— skip-list matching including*.egg-infoglob_path_is_safe(path, target)—ai.py:69— path containment check_block_to_dict(block)—ai.py:1007— SDK block → plain dictFix
tests/test_ai_pure.pycovering these helpersDevelopmentGuide.md—ai.pyis no longer fully exempt, only the API-dependent parts areCLAUDE.mdNotes
_filter_dir_toolsin particular has nontrivial branching (confidence threshold, protected tools, missing survey) and is the kind of thing that will silently break