forked from rc/aircox
Feat: packaging (#127)
- Add configuration files for packaging - Precommit now uses ruff Co-authored-by: bkfox <thomas bkfox net> Reviewed-on: rc/aircox#127
This commit is contained in:
@ -49,9 +49,7 @@ class TestSchedule:
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dates_of_month_ponctual(self):
|
||||
schedule = baker.prepare(
|
||||
Schedule, frequency=Schedule.Frequency.ponctual
|
||||
)
|
||||
schedule = baker.prepare(Schedule, frequency=Schedule.Frequency.ponctual)
|
||||
at = schedule.date + relativedelta(months=4)
|
||||
assert schedule.dates_of_month(at) == []
|
||||
|
||||
@ -59,9 +57,7 @@ class TestSchedule:
|
||||
@pytest.mark.parametrize("months", range(0, 25, 4))
|
||||
@pytest.mark.parametrize("hour", range(0, 24, 4))
|
||||
def test_dates_of_month_last(self, months, hour):
|
||||
schedule = baker.prepare(
|
||||
Schedule, time=time(hour, 00), frequency=Schedule.Frequency.last
|
||||
)
|
||||
schedule = baker.prepare(Schedule, time=time(hour, 00), frequency=Schedule.Frequency.last)
|
||||
at = schedule.date + relativedelta(months=months)
|
||||
datetimes = schedule.dates_of_month(at)
|
||||
assert len(datetimes) == 1
|
||||
@ -73,9 +69,7 @@ class TestSchedule:
|
||||
at = date(at.year, at.month, month_info[1])
|
||||
if at.weekday() < schedule.date.weekday():
|
||||
at -= timedelta(days=7)
|
||||
at += timedelta(days=schedule.date.weekday()) - timedelta(
|
||||
days=at.weekday()
|
||||
)
|
||||
at += timedelta(days=schedule.date.weekday()) - timedelta(days=at.weekday())
|
||||
assert dt.date() == at
|
||||
|
||||
# since the same method is used for first, second, etc. frequencies
|
||||
@ -84,9 +78,7 @@ class TestSchedule:
|
||||
@pytest.mark.parametrize("months", range(0, 25, 4))
|
||||
@pytest.mark.parametrize("hour", range(0, 24, 4))
|
||||
def test_dates_of_month_every(self, months, hour):
|
||||
schedule = baker.prepare(
|
||||
Schedule, time=time(hour, 00), frequency=Schedule.Frequency.every
|
||||
)
|
||||
schedule = baker.prepare(Schedule, time=time(hour, 00), frequency=Schedule.Frequency.every)
|
||||
at = schedule.date + relativedelta(months=months)
|
||||
datetimes = schedule.dates_of_month(at)
|
||||
last = None
|
||||
@ -128,8 +120,4 @@ class TestSchedule:
|
||||
episodes, diffusions = schedule.diffusions_of_month(at)
|
||||
|
||||
assert all(r.date in dates for r in episodes)
|
||||
assert all(
|
||||
(not r.initial or r.date in dates)
|
||||
and r.type == Diffusion.TYPE_ON_AIR
|
||||
for r in diffusions
|
||||
)
|
||||
assert all((not r.initial or r.date in dates) and r.type == Diffusion.TYPE_ON_AIR for r in diffusions)
|
||||
|
Reference in New Issue
Block a user