import sys import unittest from unittest.mock import MagicMock # Add project root to sys.path sys.path.append("/Users/Ahmet/Repo/TradingAgents") from agent_os.backend.services.langgraph_engine import LangGraphEngine class TestLangGraphEngineExtraction(unittest.TestCase): def setUp(self): self.engine = LangGraphEngine() def test_extract_content_string(self): mock_obj = MagicMock() mock_obj.content = "hello world" self.assertEqual(self.engine._extract_content(mock_obj), "hello world") def test_extract_content_method(self): mock_obj = MagicMock() # Mocking a method def my_content(): return "should not be called" mock_obj.content = my_content # Should fall back to str(mock_obj) result = self.engine._extract_content(mock_obj) self.assertTrue(result.startswith("