This commit is contained in:
Simple_Not 2023-07-16 14:29:54 +10:00
parent 256bdfb89b
commit 8c269fd768

View File

@ -11,12 +11,13 @@ def rolltime(check_datetime , curr_time=datetime.datetime.now()):
timediff = (time_to_grow - last_time).total_seconds() timediff = (time_to_grow - last_time).total_seconds()
# print()
# print(f'\tlast_time : {last_time}') # print(f'\tlast_time : {last_time}')
# print(f'\ttime_to_grow : {time_to_grow}') # print(f'\ttime_to_grow : {time_to_grow}')
# print(f'\tcurr_time : {curr_time.strftime("%Y-%m-%d %H:%M:%S")}') # print(f'\tcurr_time : {curr_time.strftime("%Y-%m-%d %H:%M:%S")}')
# print(f'\t\tsecs diff : {timediff}') # print(f'\t\tsecs diff : {timediff}')
if timediff > 86400 or curr_time > time_to_grow: if timediff > 86400 or (curr_time > time_to_grow and last_time < time_to_grow):
return True return True
else: else:
return False return False
@ -69,6 +70,16 @@ class TestPipisa(unittest.TestCase):
datetime.datetime.now().replace(hour=0, minute=11, second=8, microsecond=0) - datetime.timedelta(hours=15) datetime.datetime.now().replace(hour=0, minute=11, second=8, microsecond=0) - datetime.timedelta(hours=15)
), False, "Где-то ночью прокручивается повторно. Фейл.") ), False, "Где-то ночью прокручивается повторно. Фейл.")
def test_somewhere_after(self):
self.assertEqual(
rolltime(
(
datetime.datetime.now().replace(hour=14, minute=26, second=8, microsecond=0)
).strftime('%Y-%m-%d %H:%M:%S'),
datetime.datetime.now().replace(hour=14, minute=27, second=8, microsecond=0)
), False, "Сегодня уже открутили а хотят ещё. Фейл.")