mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-22 02:41:28 +00:00
added some test for test test :D
This commit is contained in:
parent
9b1fc812d4
commit
ba6fce2b56
29
test.py
Normal file
29
test.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import unittest
|
||||
import datetime
|
||||
import time_machine
|
||||
from src import sheduler
|
||||
|
||||
|
||||
class TestDate(unittest.TestCase):
|
||||
def test_date_tue(self):
|
||||
"""
|
||||
test near tue
|
||||
"""
|
||||
import calendar
|
||||
import random
|
||||
for month in range(1, 13):
|
||||
sundays = [i for i in calendar.Calendar().itermonthdays4(year=2024, month=month) if i[3] == 6]
|
||||
for sunday in sundays:
|
||||
fake_date = datetime.datetime(year=sunday[0], month=sunday[1], day=sunday[2], hour=random.randint(21, 23))
|
||||
with time_machine.travel(fake_date):
|
||||
try:
|
||||
result = sheduler.check_stop_thread_scan(fake_date)
|
||||
print("current fake date: " + fake_date.strftime("%Y.%m.%d %H:%M") + f" near tue: {result}")
|
||||
except:
|
||||
print("fail fake date: " + fake_date.strftime("%Y.%m.%d %H:%M"))
|
||||
#self.assertEqual(result, datetime.datetime(year=2024, month=7, day=2, hour=16))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in a new issue