import pytest import ast from pathlib import Path from src.outline_tool import CodeOutliner def test_code_outliner_type_hints(): code = """ class Test: def my_method(self, x: int) -> str: return "hello" def my_func(a: bool) -> None: pass """ outliner = CodeOutliner() result = outliner.outline(code) assert "[Method] my_method -> str (Lines 3-4)" in result assert "[Func] my_func -> None (Lines 6-7)" in result def test_code_outliner_imgui_scopes(): code = """ def render_gui() -> None: with imscope.window("My Window"): imgui.text("Hello") with imscope.child("My Child"): pass """ outliner = CodeOutliner() result = outliner.outline(code) assert "[ImGui Scope] imscope.window('My Window') (Lines 3-6)" in result assert "[ImGui Scope] imscope.child('My Child') (Lines 5-6)" in result def test_code_outliner_nested_ifs(): code = """ def render_gui() -> None: if True: with imscope.window("My Window"): pass """ outliner = CodeOutliner() result = outliner.outline(code) assert "[ImGui Scope] imscope.window('My Window') (Lines 4-5)" in result