Skip to content

Commit a3e90a1

Browse files
jpheinclaude
andcommitted
test(searcher): fix mock_col.count in CLI None-metadata test
_count_in_scope calls col.count() for unfiltered scopes; MagicMock needs count.return_value set explicitly or comparison with int raises. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4f10b71 commit a3e90a1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tests/test_searcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,13 @@ def test_search_n_results(self, palace_path, seeded_collection, capsys):
244244
# Should have output with at least one result block
245245
assert "[1]" in captured.out
246246

247-
def test_search_handles_none_metadata_without_crash(self, palace_path, capsys):
247+
def test_search_handles_none_metadata_without_crash(self, capsys):
248248
"""ChromaDB can return `None` entries in the metadatas list when a
249249
drawer has no metadata. The CLI print path must not crash on them
250250
mid-render — it used to raise `AttributeError: 'NoneType' object has
251251
no attribute 'get'` after printing earlier results."""
252252
mock_col = MagicMock()
253+
mock_col.count.return_value = 2
253254
mock_col.query.return_value = {
254255
"documents": [["first doc", "second doc"]],
255256
"metadatas": [[{"source_file": "a.md", "wing": "w", "room": "r"}, None]],

0 commit comments

Comments
 (0)