import unittest
from unittest.mock import MagicMock


class TestContextTruthiness(unittest.TestCase):
    def test_repro_context_truthiness_bug(self):
        """
        Verifies that 'CONTEXT_LOST' string is NOT treated as True when using 'is True' check.
        """
        # Mock nav_graph
        nav_graph = MagicMock()
        nav_graph._execute_transition.return_value = "CONTEXT_LOST"

        # Simulate the logic in bot_flow.py (FIXED)
        success = nav_graph._execute_transition("tap_comment_button", MagicMock())

        # This is the FIXED logic
        if success is True:
            is_buggy = True
        else:
            is_buggy = False

        self.assertFalse(is_buggy, "Should NOT be buggy: 'CONTEXT_LOST' is not 'True'")
        print("\n[V] VERIFICATION SUCCESSFUL: 'CONTEXT_LOST' string rejected by 'is True' check.")


if __name__ == "__main__":
    unittest.main()
