|
|
import numpy as np |
|
|
import pytest |
|
|
from types import SimpleNamespace |
|
|
|
|
|
from cognitive_mapping_probe.orchestrator_seismograph import run_seismic_analysis |
|
|
|
|
|
def test_seismic_analysis_orchestrator(mocker, mock_llm): |
|
|
""" |
|
|
Testet den `run_seismic_analysis` Orchestrator. |
|
|
Wir mocken die darunterliegende `run_silent_cogitation_seismic`, um das Verhalten |
|
|
des Orchestrators isoliert zu prüfen. |
|
|
ASSERT: Berechnet korrekte Statistiken und gibt die erwartete Datenstruktur zurück. |
|
|
""" |
|
|
|
|
|
mock_deltas = [1.0, 2.0, 3.0, 4.0, 5.0] |
|
|
mocker.patch('cognitive_mapping_probe.orchestrator_seismograph.run_silent_cogitation_seismic', return_value=mock_deltas) |
|
|
|
|
|
|
|
|
mock_progress = mocker.MagicMock() |
|
|
|
|
|
|
|
|
results = run_seismic_analysis( |
|
|
model_id="mock_model", |
|
|
prompt_type="test_prompt", |
|
|
seed=42, |
|
|
num_steps=5, |
|
|
progress_callback=mock_progress |
|
|
) |
|
|
|
|
|
|
|
|
assert "verdict" in results |
|
|
assert "stats" in results |
|
|
assert "state_deltas" in results |
|
|
|
|
|
stats = results["stats"] |
|
|
assert stats["mean_delta"] == pytest.approx(np.mean(mock_deltas)) |
|
|
assert stats["std_delta"] == pytest.approx(np.std(mock_deltas)) |
|
|
assert stats["max_delta"] == pytest.approx(max(mock_deltas)) |
|
|
|
|
|
assert results["state_deltas"] == mock_deltas |
|
|
|
|
|
|
|
|
assert mock_progress.call_count > 0 |
|
|
|