test_grep_count_mode() — langchain Function Reference
Architecture documentation for the test_grep_count_mode() function in test_file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0116119d_4257_828b_9295_7d90d0c8a5d8["test_grep_count_mode()"] cc6c9310_5391_59ed_60fd_270a44975195["TestFilesystemGrepSearch"] 0116119d_4257_828b_9295_7d90d0c8a5d8 -->|defined in| cc6c9310_5391_59ed_60fd_270a44975195 style 0116119d_4257_828b_9295_7d90d0c8a5d8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py lines 272–299
def test_grep_count_mode(self) -> None:
"""Test grep with count output mode."""
middleware = StateFileSearchMiddleware()
state: AnthropicToolsState = {
"messages": [],
"text_editor_files": {
"/src/main.py": {
"content": ["TODO: fix this", "print('hello')", "TODO: add tests"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
"/src/utils.py": {
"content": ["TODO: implement"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
},
}
result = middleware._handle_grep_search(
pattern=r"TODO", path="/", include=None, output_mode="count", state=state
)
assert isinstance(result, str)
lines = result.split("\n")
assert "/src/main.py:2" in lines
assert "/src/utils.py:1" in lines
Domain
Subdomains
Source
Frequently Asked Questions
What does test_grep_count_mode() do?
test_grep_count_mode() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py.
Where is test_grep_count_mode() defined?
test_grep_count_mode() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py at line 272.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free