Exemplo n.º 1
0
    def test_get_next_after_last(self) -> None:
        tpds1 = TimePeriodSetting('01:00', 25, SettingModes.ON)
        tpds2 = TimePeriodSetting('05:00', 20, SettingModes.OFF)
        tpds3 = TimePeriodSetting('08:00', 20, SettingModes.OFF)
        tpds_day_after = TimePeriodSetting('03:00', 20, SettingModes.OFF)

        monday = TimeProgramDay([tpds1, tpds2, tpds3])
        tuesday = TimeProgramDay([tpds_day_after])

        timeprogram = TimeProgram({'monday': monday, 'tuesday': tuesday})

        next_setting = timeprogram.get_next(datetime(2019, 2, 18, 9, 30))

        self._assert(next_setting, tpds_day_after)
Exemplo n.º 2
0
    def test_get_next_between_same_day(self) -> None:
        tpds1 = TimePeriodSetting("01:00", 25, SettingModes.ON)
        tpds2 = TimePeriodSetting("05:00", 20, SettingModes.OFF)
        tpds3 = TimePeriodSetting("08:00", 20, SettingModes.OFF)
        tpds_day_after = TimePeriodSetting("03:00", 20, SettingModes.OFF)

        monday = TimeProgramDay([tpds1, tpds2, tpds3])
        tuesday = TimeProgramDay([tpds_day_after])

        timeprogram = TimeProgram({"monday": monday, "tuesday": tuesday})

        next_setting = timeprogram.get_next(datetime(2019, 2, 18, 4, 30))

        self._assert(next_setting, tpds2)