import pytest
import inspect


def test_context_composition_panel_replaces_placeholder():
 import src.gui_2 as gui_2

 source = inspect.getsource(gui_2.render_discussion_hub)
 assert "_render_context_composition_placeholder" not in source, (
  "Placeholder should be replaced"
 )
 assert "render_context_composition_panel" in source, (
  "Should have render_context_composition_panel"
 )


def test_context_composition_has_save_load_buttons():
 import src.gui_2 as gui_2

 source = inspect.getsource(gui_2.render_context_presets)
 assert "Save##ctx" in source or "save" in source.lower(), (
  "Should have Save functionality"
 )
 assert "load_context_preset" in source or "load" in source.lower(), (
  "Should have Load functionality"
 )


def test_context_composition_shows_files():
 import src.gui_2 as gui_2

 source = inspect.getsource(gui_2.render_context_composition_panel)
 assert "files" in source.lower() or "Files" in source, "Should show files"


def test_context_composition_has_preset_list():
 import src.gui_2 as gui_2

 source = inspect.getsource(gui_2.render_context_composition_panel)
 assert "context_presets" in source or "preset" in source.lower(), (
  "Should reference presets"
 )
