Home / Function/ test_edit_single_occurrence() — langchain Function Reference

test_edit_single_occurrence() — langchain Function Reference

Architecture documentation for the test_edit_single_occurrence() function in sandboxes.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dc02da34_dc6e_8732_e0d7_397a1b1947de["test_edit_single_occurrence()"]
  44713bb8_64c7_b8af_22f9_b6db34868592["SandboxIntegrationTests"]
  dc02da34_dc6e_8732_e0d7_397a1b1947de -->|defined in| 44713bb8_64c7_b8af_22f9_b6db34868592
  style dc02da34_dc6e_8732_e0d7_397a1b1947de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/sandboxes.py lines 116–130

    def test_edit_single_occurrence(
        self, sandbox_backend: SandboxBackendProtocol
    ) -> None:
        """Edit a file and assert exactly one occurrence was replaced."""
        if not self.has_sync:
            pytest.skip("Sync tests not supported.")
        test_path = "/tmp/test_sandbox_ops/edit_single.txt"
        content = "Hello world\nGoodbye world\nHello again"
        sandbox_backend.write(test_path, content)
        result = sandbox_backend.edit(test_path, "Goodbye", "Farewell")
        assert result.error is None
        assert result.occurrences == 1
        file_content = sandbox_backend.read(test_path)
        assert "Farewell world" in file_content
        assert "Goodbye" not in file_content

Domain

Subdomains

Frequently Asked Questions

What does test_edit_single_occurrence() do?
test_edit_single_occurrence() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/sandboxes.py.
Where is test_edit_single_occurrence() defined?
test_edit_single_occurrence() is defined in libs/standard-tests/langchain_tests/integration_tests/sandboxes.py at line 116.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free