single dow

This commit is contained in:
boyska 2018-01-07 13:00:48 +01:00
parent cf87e73cd5
commit a862fe3e1e

View file

@ -51,6 +51,16 @@ def onehour_sunday(request):
})
@pytest.fixture(params=[1, 2, 3, 4, 5, 6, 7])
def singledow(request):
weekday = request.param
yield FrequencyAlarm({
'interval': 3600*24,
'weekdays': [weekday],
'start': 0
})
@pytest.fixture(params=['seconds', 'human', 'coloned'])
def tenseconds(now, request):
'''a FrequencyAlarm: every 10 seconds for one day'''
@ -172,6 +182,17 @@ def test_long_interval(manyweeks):
assert manyweeks.next_ring(got) is not None
def test_singledow(singledow):
t = datetime.fromtimestamp(1)
got = singledow.next_ring(t)
wd = singledow.weekdays[0]
assert got is not None
assert got.isoweekday() == wd
assert singledow.next_ring(got) is not None
assert singledow.next_ring(got).isoweekday() == wd
def test_single_registered():
timegenerate({
'kind': 'single',