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()

[((30, 4, 30, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((16, 19, 16, 33), 'datetime.time', 'time', ({(16, 24, 16, 26): '10', (16, 28, 16, 29): '0', (16, 31, 16, 32): '0'}, {}), '(10, 0, 0)', False, 'from datetime import time\n'), ((17, 17, 17, 31), 'datetime.time', 'time', ({(17, 22, 17, 24): '12', (17, 26, 17, 27): '0', (17, 29, 17, 30): '0'}, {}), '(12, 0, 0)', False, 'from datetime import time\n'), ((18, 32, 18, 73), 'core.controller.BaseTimeRangeController', 'BaseTimeRangeController', ({(18, 56, 18, 64): 'start_at', (18, 66, 18, 72): 'end_at'}, {}), '(start_at, end_at)', False, 'from core.controller import BaseTimeRangeController\n'), ((20, 19, 20, 33), 'datetime.time', 'time', ({(20, 24, 20, 26): '11', (20, 28, 20, 29): '0', (20, 31, 20, 32): '0'}, {}), '(11, 0, 0)', False, 'from datetime import time\n'), ((24, 19, 24, 34), 'datetime.time', 'time', ({(24, 24, 24, 26): '12', (24, 28, 24, 30): '15', (24, 32, 24, 33): '0'}, {}), '(12, 15, 0)', False, 'from datetime import time\n'), ((8, 55, 8, 82), 'os.path.dirname', 'os.path.dirname', ({(8, 71, 8, 81): '"""__file__"""'}, {}), "('__file__')", False, 'import os\n')]