bench: add benchmark runners, results docs, and test suite
Benchmarks: LongMemEval, LoCoMo, ConvoMem, MemBench runners with methodology docs and hybrid retrieval analysis. Tests: config, miner, convo_miner, normalize — 9 tests, all passing.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import os
|
||||
import json
|
||||
import tempfile
|
||||
from mempalace.config import MempalaceConfig
|
||||
|
||||
|
||||
def test_default_config():
|
||||
cfg = MempalaceConfig(config_dir=tempfile.mkdtemp())
|
||||
assert "palace" in cfg.palace_path
|
||||
assert cfg.collection_name == "mempalace_drawers"
|
||||
|
||||
|
||||
def test_config_from_file():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
with open(os.path.join(tmpdir, "config.json"), "w") as f:
|
||||
json.dump({"palace_path": "/custom/palace"}, f)
|
||||
cfg = MempalaceConfig(config_dir=tmpdir)
|
||||
assert cfg.palace_path == "/custom/palace"
|
||||
|
||||
|
||||
def test_env_override():
|
||||
os.environ["MEMPALACE_PALACE_PATH"] = "/env/palace"
|
||||
cfg = MempalaceConfig(config_dir=tempfile.mkdtemp())
|
||||
assert cfg.palace_path == "/env/palace"
|
||||
del os.environ["MEMPALACE_PALACE_PATH"]
|
||||
|
||||
|
||||
def test_init():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
cfg = MempalaceConfig(config_dir=tmpdir)
|
||||
cfg.init()
|
||||
assert os.path.exists(os.path.join(tmpdir, "config.json"))
|
||||
Reference in New Issue
Block a user