test_grep_files_with_matches_mode() — langchain Function Reference
Architecture documentation for the test_grep_files_with_matches_mode() function in test_file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD beb48a91_ab19_4b0b_9d64_95f563265515["test_grep_files_with_matches_mode()"] 04253b83_b0c4_093c_88ed_3a4808eaf00b["TestGrepSearch"] beb48a91_ab19_4b0b_9d64_95f563265515 -->|defined in| 04253b83_b0c4_093c_88ed_3a4808eaf00b style beb48a91_ab19_4b0b_9d64_95f563265515 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py lines 175–212
def test_grep_files_with_matches_mode(self) -> None:
"""Test grep with files_with_matches output mode."""
middleware = StateFileSearchMiddleware()
state: AnthropicToolsState = {
"messages": [],
"text_editor_files": {
"/src/main.py": {
"content": ["def foo():", " pass"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
"/src/utils.py": {
"content": ["def bar():", " return None"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
"/README.md": {
"content": ["# Documentation", "No code here"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
},
}
result = middleware._handle_grep_search(
pattern=r"def \w+\(\):",
path="/",
include=None,
output_mode="files_with_matches",
state=state,
)
assert isinstance(result, str)
assert "/src/main.py" in result
assert "/src/utils.py" in result
assert "/README.md" not in result
# Should only have file paths, not line content
Domain
Subdomains
Source
Frequently Asked Questions
What does test_grep_files_with_matches_mode() do?
test_grep_files_with_matches_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_files_with_matches_mode() defined?
test_grep_files_with_matches_mode() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py at line 175.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free