MCPcopy
hub / github.com/MinishLab/semble / test_cli_content_argument

Function test_cli_content_argument

tests/test_cli.py:198–210  ·  view source on GitHub ↗

--content parses into the right ContentType list (including the 'all' shorthand and default).

(
    argv_content: list[str],
    expected: list[ContentType],
    monkeypatch: pytest.MonkeyPatch,
)

Source from the content-addressed store, hash-verified

196 ],
197)
198def test_cli_content_argument(
199 argv_content: list[str],
200 expected: list[ContentType],
201 monkeypatch: pytest.MonkeyPatch,
202) -> None:
203 """--content parses into the right ContentType list (including the 'all' shorthand and default)."""
204 chunk = make_chunk("def foo(): pass", "src/foo.py")
205 fake_index = MagicMock()
206 fake_index.search.return_value = [SearchResult(chunk=chunk, score=0.9)]
207 monkeypatch.setattr(sys, "argv", ["semble", "search", "query", "/some/path", *argv_content])
208 with patch("semble.cli.SembleIndex.from_path", return_value=fake_index) as mock_from_path:
209 _cli_main()
210 assert list(mock_from_path.call_args.kwargs["content"]) == expected
211
212
213def test_maybe_save_index_logs_error_on_save_failure(capsys: pytest.CaptureFixture[str]) -> None:

Callers

nothing calls this directly

Calls 3

make_chunkFunction · 0.90
SearchResultClass · 0.90
_cli_mainFunction · 0.90

Tested by

no test coverage detected