mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 19:02:16 +00:00
Complete implementation across six development phases (v0.1 through v1.0): - Core: Registry system, config, event bus, types (Phase 0) - Intelligence + Inference: Model routing, Ollama/vLLM/llama.cpp/Cloud engines (Phase 1) - Memory: SQLite/FAISS/ColBERT/BM25/Hybrid backends, document ingest, context injection (Phase 2) - Agents: Simple/Orchestrator/Custom/OpenClaw agents, tool system (Phase 3) - Learning: HeuristicRouter, reward functions, GRPO stub, telemetry aggregation (Phase 4) - SDK: Jarvis class, OpenClaw protocol/transport, benchmarks, Docker deployment (Phase 5) 520 tests passing, 8 skipped (optional deps). Ruff lint clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""Phase 5 foundation tests — BenchmarkRegistry and config."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from openjarvis.core.config import JarvisConfig, load_config
|
|
from openjarvis.core.registry import BenchmarkRegistry
|
|
|
|
|
|
class TestBenchmarkRegistry:
|
|
def test_register_and_get(self):
|
|
BenchmarkRegistry.register_value("test-bench", "dummy")
|
|
assert BenchmarkRegistry.get("test-bench") == "dummy"
|
|
|
|
def test_keys(self):
|
|
BenchmarkRegistry.register_value("a", 1)
|
|
BenchmarkRegistry.register_value("b", 2)
|
|
assert set(BenchmarkRegistry.keys()) == {"a", "b"}
|
|
|
|
def test_contains(self):
|
|
BenchmarkRegistry.register_value("present", True)
|
|
assert BenchmarkRegistry.contains("present")
|
|
assert not BenchmarkRegistry.contains("absent")
|
|
|
|
def test_duplicate_raises(self):
|
|
BenchmarkRegistry.register_value("dup", 1)
|
|
with pytest.raises(ValueError, match="already has an entry"):
|
|
BenchmarkRegistry.register_value("dup", 2)
|
|
|
|
|
|
class TestConfigPhase5:
|
|
def test_jarvis_config_loads(self):
|
|
cfg = JarvisConfig()
|
|
assert cfg.engine is not None
|
|
assert cfg.learning is not None
|
|
|
|
def test_benchmark_registry_importable(self):
|
|
from openjarvis.core.registry import BenchmarkRegistry
|
|
|
|
assert BenchmarkRegistry is not None
|
|
|
|
def test_registry_isolation(self):
|
|
"""BenchmarkRegistry entries don't leak into other registries."""
|
|
from openjarvis.core.registry import ModelRegistry
|
|
|
|
BenchmarkRegistry.register_value("iso-test", "bench-value")
|
|
with pytest.raises(KeyError):
|
|
ModelRegistry.get("iso-test")
|
|
|
|
def test_load_config_default(self):
|
|
cfg = load_config()
|
|
assert isinstance(cfg, JarvisConfig)
|