import inspect
import sys
import os
import pytest

# Ensure project root is in path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

def test_gui_monolithic_symbols():
 try:
  from src.gui_2 import App, render_discussion_entry, render_thinking_trace
  import src.gui_2
 except ImportError as e:
  pytest.fail(f"FAILURE: Could not import from src.gui_2: {e}")

 # Verify App is importable
 assert App is not None

 # Verify render_discussion_entry is in src.gui_2
 assert hasattr(src.gui_2, 'render_discussion_entry'), "render_discussion_entry missing from src.gui_2"

 # Verify it's defined in src.gui_2, not imported
 mod = inspect.getmodule(render_discussion_entry)
 assert mod is not None, "Could not determine module for render_discussion_entry"
 assert mod.__name__ == 'src.gui_2', f"render_discussion_entry expected in src.gui_2, but found in {mod.__name__}"

 # Verify render_thinking_trace is in src.gui_2
 assert hasattr(src.gui_2, 'render_thinking_trace'), "render_thinking_trace missing from src.gui_2"

 # Verify it's defined in src.gui_2, not imported
 mod = inspect.getmodule(render_thinking_trace)
 assert mod is not None, "Could not determine module for render_thinking_trace"
 assert mod.__name__ == 'src.gui_2', f"render_thinking_trace expected in src.gui_2, but found in {mod.__name__}"
