This commit is contained in:
parent
256bdfb89b
commit
8c269fd768
@ -11,12 +11,13 @@ def rolltime(check_datetime , curr_time=datetime.datetime.now()):
|
||||
|
||||
timediff = (time_to_grow - last_time).total_seconds()
|
||||
|
||||
# print()
|
||||
# print(f'\tlast_time : {last_time}')
|
||||
# print(f'\ttime_to_grow : {time_to_grow}')
|
||||
# print(f'\tcurr_time : {curr_time.strftime("%Y-%m-%d %H:%M:%S")}')
|
||||
# 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
|
||||
else:
|
||||
return False
|
||||
@ -68,6 +69,16 @@ class TestPipisa(unittest.TestCase):
|
||||
).strftime('%Y-%m-%d %H:%M:%S'),
|
||||
datetime.datetime.now().replace(hour=0, minute=11, second=8, microsecond=0) - datetime.timedelta(hours=15)
|
||||
), 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, "Сегодня уже открутили а хотят ещё. Фейл.")
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user