mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-29 01:31:41 +00:00
refactor(mem0_oss): update tests/plugins/memory/test_mem0_oss_provider.py
This commit is contained in:
parent
c4b925081f
commit
c6ee9ffcb1
1 changed files with 36 additions and 2 deletions
|
|
@ -610,9 +610,9 @@ class TestSchemas:
|
|||
|
||||
def test_get_tool_schemas_returns_both(self, provider):
|
||||
schemas = provider.get_tool_schemas()
|
||||
assert len(schemas) == 1
|
||||
assert len(schemas) == 2
|
||||
names = {s["name"] for s in schemas}
|
||||
assert names == {"mem0_oss_search"}
|
||||
assert names == {"mem0_oss_search", "mem0_oss_add"}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -836,6 +836,7 @@ class TestSystemPromptBlock:
|
|||
def test_mentions_tool_names(self, provider):
|
||||
block = provider.system_prompt_block()
|
||||
assert "mem0_oss_search" in block
|
||||
assert "mem0_oss_add" in block
|
||||
|
||||
def test_mentions_long_term_memory(self, provider):
|
||||
block = provider.system_prompt_block()
|
||||
|
|
@ -883,6 +884,39 @@ class TestConfigSchema:
|
|||
assert key_entry.get("secret") is True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pre-initialization safety (__init__ defaults)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestPreInit:
|
||||
"""Provider must be safe to inspect before initialize() is called."""
|
||||
|
||||
def test_name_before_init(self):
|
||||
p = Mem0OSSMemoryProvider()
|
||||
assert p.name == "mem0_oss"
|
||||
|
||||
def test_lock_exists_before_init(self):
|
||||
"""_lock must exist from __init__ so circuit-breaker methods don't crash."""
|
||||
p = Mem0OSSMemoryProvider()
|
||||
assert hasattr(p, "_lock")
|
||||
import threading
|
||||
assert isinstance(p._lock, type(threading.Lock()))
|
||||
|
||||
def test_fail_count_zero_before_init(self):
|
||||
p = Mem0OSSMemoryProvider()
|
||||
assert p._fail_count == 0
|
||||
|
||||
def test_threads_none_before_init(self):
|
||||
p = Mem0OSSMemoryProvider()
|
||||
assert p._sync_thread is None
|
||||
assert p._prefetch_thread is None
|
||||
|
||||
def test_prefetch_result_empty_before_init(self):
|
||||
p = Mem0OSSMemoryProvider()
|
||||
assert p._prefetch_result == ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# initialize
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue