test_get_or_create_resources_creates_when_missing() — langchain Function Reference
Architecture documentation for the test_get_or_create_resources_creates_when_missing() function in test_shell_tool.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 80f48a86_9c15_3a10_3fc2_7f8a65a4a763["test_get_or_create_resources_creates_when_missing()"] f21fd460_1d0c_cb92_cfa1_eae0890e2f58["test_shell_tool.py"] 80f48a86_9c15_3a10_3fc2_7f8a65a4a763 -->|defined in| f21fd460_1d0c_cb92_cfa1_eae0890e2f58 1bc202d6_8b54_02e9_fadd_ff3171c38a75["_empty_state()"] 80f48a86_9c15_3a10_3fc2_7f8a65a4a763 -->|calls| 1bc202d6_8b54_02e9_fadd_ff3171c38a75 style 80f48a86_9c15_3a10_3fc2_7f8a65a4a763 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py lines 510–528
def test_get_or_create_resources_creates_when_missing(tmp_path: Path) -> None:
"""Test that _get_or_create_resources creates resources when they don't exist."""
workspace = tmp_path / "workspace"
middleware = ShellToolMiddleware(workspace_root=workspace)
state = _empty_state()
# State has no resources initially
assert "shell_session_resources" not in state
# Call _get_or_create_resources - should create new resources
resources = middleware._get_or_create_resources(state)
assert isinstance(resources, _SessionResources)
assert resources.session is not None
assert state.get("shell_session_resources") is resources
# Clean up
resources.finalizer()
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_get_or_create_resources_creates_when_missing() do?
test_get_or_create_resources_creates_when_missing() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py.
Where is test_get_or_create_resources_creates_when_missing() defined?
test_get_or_create_resources_creates_when_missing() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py at line 510.
What does test_get_or_create_resources_creates_when_missing() call?
test_get_or_create_resources_creates_when_missing() calls 1 function(s): _empty_state.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free