Home / Function/ test_rename_operation() — langchain Function Reference

test_rename_operation() — langchain Function Reference

Architecture documentation for the test_rename_operation() function in test_anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  03f2d9f0_599a_8474_5392_f1cc5f568beb["test_rename_operation()"]
  6ec57bb9_6c88_435d_d3c5_ccf498cb814d["TestFileOperations"]
  03f2d9f0_599a_8474_5392_f1cc5f568beb -->|defined in| 6ec57bb9_6c88_435d_d3c5_ccf498cb814d
  style 03f2d9f0_599a_8474_5392_f1cc5f568beb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/middleware/test_anthropic_tools.py lines 254–283

    def test_rename_operation(self) -> None:
        """Test rename command execution (memory only)."""
        middleware = StateClaudeMemoryMiddleware()

        state: AnthropicToolsState = {
            "messages": [],
            "memory_files": {
                "/memories/old.txt": {
                    "content": ["line1"],
                    "created_at": "2025-01-01T00:00:00",
                    "modified_at": "2025-01-01T00:00:00",
                }
            },
        }

        args = {
            "command": "rename",
            "old_path": "/memories/old.txt",
            "new_path": "/memories/new.txt",
        }
        result = middleware._handle_rename(args, state, "test_id")

        assert isinstance(result, Command)
        assert result.update is not None
        files = result.update.get("memory_files", {})
        # Old path is marked as None (deleted)
        assert files.get("/memories/old.txt") is None
        # New path has the file data
        assert files.get("/memories/new.txt") is not None
        assert files["/memories/new.txt"]["content"] == ["line1"]

Domain

Subdomains

Frequently Asked Questions

What does test_rename_operation() do?
test_rename_operation() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/middleware/test_anthropic_tools.py.
Where is test_rename_operation() defined?
test_rename_operation() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_anthropic_tools.py at line 254.

Analyze Your Own Codebase

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

Try Supermodel Free