test_grep_with_base_path() — langchain Function Reference
Architecture documentation for the test_grep_with_base_path() function in test_file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 411a35ae_c468_438d_94dd_f0e2542e1947["test_grep_with_base_path()"] cc6c9310_5391_59ed_60fd_270a44975195["TestFilesystemGrepSearch"] 411a35ae_c468_438d_94dd_f0e2542e1947 -->|defined in| cc6c9310_5391_59ed_60fd_270a44975195 style 411a35ae_c468_438d_94dd_f0e2542e1947 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py lines 371–401
def test_grep_with_base_path(self) -> None:
"""Test grep with base path restriction."""
middleware = StateFileSearchMiddleware()
state: AnthropicToolsState = {
"messages": [],
"text_editor_files": {
"/src/main.py": {
"content": ["import foo"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
"/tests/test.py": {
"content": ["import foo"],
"created_at": "2025-01-01T00:00:00",
"modified_at": "2025-01-01T00:00:00",
},
},
}
result = middleware._handle_grep_search(
pattern="import",
path="/src",
include=None,
output_mode="files_with_matches",
state=state,
)
assert isinstance(result, str)
assert "/src/main.py" in result
assert "/tests/test.py" not in result
Domain
Subdomains
Source
Frequently Asked Questions
What does test_grep_with_base_path() do?
test_grep_with_base_path() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py.
Where is test_grep_with_base_path() defined?
test_grep_with_base_path() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py at line 371.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free