import os
import sys
from datetime import time
import unittest

sys.path.append(
    os.path.dirname(
        os.path.dirname(os.path.join("..", "..", "..", os.path.dirname("__file__")))
    )
)
from core.controller import BaseTimeRangeController


class TestTimeRangeController(unittest.TestCase):
    def test_time_range(self):
        start_at = time(10, 0, 0)
        end_at = time(12, 0, 0)
        time_range_controller = BaseTimeRangeController(start_at, end_at)

        time_now = time(11, 0, 0)
        time_range_controller.set_current_time(time_now)
        self.assertTrue(time_range_controller.action)

        time_now = time(12, 15, 0)
        time_range_controller.set_current_time(time_now)
        self.assertFalse(time_range_controller.action)


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

[((797, 812), 'unittest.main', 'unittest.main', ([], {}), '()\n', (810, 812), False, 'import unittest\n'), ((349, 363), 'datetime.time', 'time', (['(10)', '(0)', '(0)'], {}), '(10, 0, 0)\n', (353, 363), False, 'from datetime import time\n'), ((381, 395), 'datetime.time', 'time', (['(12)', '(0)', '(0)'], {}), '(12, 0, 0)\n', (385, 395), False, 'from datetime import time\n'), ((428, 469), 'core.controller.BaseTimeRangeController', 'BaseTimeRangeController', (['start_at', 'end_at'], {}), '(start_at, end_at)\n', (451, 469), False, 'from core.controller import BaseTimeRangeController\n'), ((490, 504), 'datetime.time', 'time', (['(11)', '(0)', '(0)'], {}), '(11, 0, 0)\n', (494, 504), False, 'from datetime import time\n'), ((636, 651), 'datetime.time', 'time', (['(12)', '(15)', '(0)'], {}), '(12, 15, 0)\n', (640, 651), False, 'from datetime import time\n'), ((157, 184), 'os.path.dirname', 'os.path.dirname', (['"""__file__"""'], {}), "('__file__')\n", (172, 184), False, 'import os\n')]