test_ripgrep_command_uses_literal_pattern() — langchain Function Reference
Architecture documentation for the test_ripgrep_command_uses_literal_pattern() function in test_file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 06919874_a62c_1075_68d3_ccf60969515a["test_ripgrep_command_uses_literal_pattern()"] 3358c7da_0c80_0cf4_72fe_8cc779a1ec74["TestFilesystemGrepSearch"] 06919874_a62c_1075_68d3_ccf60969515a -->|defined in| 3358c7da_0c80_0cf4_72fe_8cc779a1ec74 style 06919874_a62c_1075_68d3_ccf60969515a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py lines 32–59
def test_ripgrep_command_uses_literal_pattern(
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Ensure ripgrep receives pattern after ``--`` to avoid option parsing."""
(tmp_path / "example.py").write_text("print('hello')\n", encoding="utf-8")
middleware = FilesystemFileSearchMiddleware(root_path=str(tmp_path), use_ripgrep=True)
captured: dict[str, list[str]] = {}
class DummyResult:
stdout = ""
def fake_run(*args: Any, **kwargs: Any) -> DummyResult:
cmd = args[0]
captured["cmd"] = cmd
return DummyResult()
monkeypatch.setattr("langchain.agents.middleware.file_search.subprocess.run", fake_run)
middleware._ripgrep_search("--pattern", "/", None)
assert "cmd" in captured
cmd = captured["cmd"]
assert cmd[:2] == ["rg", "--json"]
assert "--" in cmd
separator_index = cmd.index("--")
assert cmd[separator_index + 1] == "--pattern"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_ripgrep_command_uses_literal_pattern() do?
test_ripgrep_command_uses_literal_pattern() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py.
Where is test_ripgrep_command_uses_literal_pattern() defined?
test_ripgrep_command_uses_literal_pattern() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free