Spaces:
Sleeping
Sleeping
| import pytest | |
| import pandas as pd | |
| # KORREKTUR: Importiere den neuen, korrekten Funktionsnamen | |
| from app import run_single_analysis_display | |
| from cognitive_mapping_probe.orchestrator_seismograph import run_seismic_analysis | |
| def test_end_to_end_with_mock_llm(mock_llm, mocker): | |
| """ | |
| Ein End-to-End-Integrationstest, der den gesamten Datenfluss validiert. | |
| """ | |
| # 1. Führe den Orchestrator mit dem `mock_llm` aus. | |
| results = run_seismic_analysis( | |
| model_id="mock_model", | |
| prompt_type="control_long_prose", | |
| seed=42, | |
| num_steps=5, | |
| concept_to_inject="test_concept", | |
| injection_strength=1.0, | |
| progress_callback=mocker.MagicMock() | |
| ) | |
| assert "stats" in results | |
| assert len(results["state_deltas"]) == 5 | |
| # 2. Mocke den Orchestrator, um die App-Logik zu testen | |
| mocker.patch('app.run_seismic_analysis', return_value=results) | |
| # 3. Führe die App-Logik (umbenannte Funktion) aus | |
| _, plot_df, _ = run_single_analysis_display( | |
| "mock_model", "control_long_prose", 42, 5, "test_concept", 1.0, progress=mocker.MagicMock() | |
| ) | |
| assert isinstance(plot_df, pd.DataFrame) | |
| assert len(plot_df) == 5 | |
| assert "State Change (Delta)" in plot_df.columns | |