feat(thinking): Phases 1-2 complete - parser, model, tests
This commit is contained in:
52
tests/test_thinking_gui.py
Normal file
52
tests/test_thinking_gui.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import pytest
|
||||
from src.gui_2 import App
|
||||
|
||||
|
||||
def test_render_thinking_trace_helper_exists():
|
||||
assert hasattr(App, "_render_thinking_trace"), (
|
||||
"_render_thinking_trace helper should exist in App class"
|
||||
)
|
||||
|
||||
|
||||
def test_discussion_entry_with_thinking_segments():
|
||||
entry = {
|
||||
"role": "AI",
|
||||
"content": "Here's my response",
|
||||
"thinking_segments": [
|
||||
{"content": "Let me analyze this step by step...", "marker": "thinking"},
|
||||
{"content": "I should consider edge cases...", "marker": "thought"},
|
||||
],
|
||||
"ts": "2026-03-13T10:00:00",
|
||||
"collapsed": False,
|
||||
}
|
||||
assert "thinking_segments" in entry
|
||||
assert len(entry["thinking_segments"]) == 2
|
||||
|
||||
|
||||
def test_discussion_entry_without_thinking():
|
||||
entry = {
|
||||
"role": "User",
|
||||
"content": "Hello",
|
||||
"ts": "2026-03-13T10:00:00",
|
||||
"collapsed": False,
|
||||
}
|
||||
assert "thinking_segments" not in entry
|
||||
|
||||
|
||||
def test_thinking_segment_model_compatibility():
|
||||
from src.models import ThinkingSegment
|
||||
|
||||
segment = ThinkingSegment(content="test", marker="thinking")
|
||||
assert segment.content == "test"
|
||||
assert segment.marker == "thinking"
|
||||
d = segment.to_dict()
|
||||
assert d["content"] == "test"
|
||||
assert d["marker"] == "thinking"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_render_thinking_trace_helper_exists()
|
||||
test_discussion_entry_with_thinking_segments()
|
||||
test_discussion_entry_without_thinking()
|
||||
test_thinking_segment_model_compatibility()
|
||||
print("All GUI thinking trace tests passed!")
|
||||
Reference in New Issue
Block a user