mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
feat(sandbox): enhance sandbox management and tool artifact handling
- Introduced SandboxManager.delete_storage method for improved storage management. - Refactored skill loading and tool artifact handling in DifyCliInitializer and SandboxBashSession. - Updated LLMNode to extract and compile tool artifacts, enhancing integration with skills. - Improved attribute management in AttrMap for better error handling and retrieval methods.
This commit is contained in:
@ -51,11 +51,27 @@ class TestAttrMap:
|
||||
|
||||
assert result == "hello"
|
||||
|
||||
def test_get_returns_none_for_missing(self):
|
||||
def test_get_raises_when_not_set(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
|
||||
assert attrs.get(key) is None
|
||||
with pytest.raises(AttrMapKeyError) as exc_info:
|
||||
attrs.get(key)
|
||||
|
||||
assert exc_info.value.key is key
|
||||
|
||||
def test_get_or_none_returns_none_for_missing(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
|
||||
assert attrs.get_or_none(key) is None
|
||||
|
||||
def test_get_or_none_returns_value_when_set(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
attrs.set(key, "hello")
|
||||
|
||||
assert attrs.get_or_none(key) == "hello"
|
||||
|
||||
def test_get_or_default_returns_value_when_set(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
@ -74,25 +90,6 @@ class TestAttrMap:
|
||||
|
||||
assert result == "default"
|
||||
|
||||
def test_require_returns_value_when_set(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
attrs.set(key, "hello")
|
||||
|
||||
result = attrs.require(key)
|
||||
|
||||
assert result == "hello"
|
||||
|
||||
def test_require_raises_when_not_set(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
|
||||
with pytest.raises(AttrMapKeyError) as exc_info:
|
||||
attrs.require(key)
|
||||
|
||||
assert exc_info.value.key is key
|
||||
assert "session" in str(exc_info.value)
|
||||
|
||||
def test_has(self):
|
||||
key: AttrKey[str] = AttrKey("session", str)
|
||||
attrs = AttrMap()
|
||||
|
||||
Reference in New Issue
Block a user