Skip to content

Commit f80e6e7

Browse files
committed
added a couple more cron tests based on croniter features
1 parent cea049b commit f80e6e7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/test_unit_trigger.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,42 @@ def test_timer_active_check(hass, spec, now, expected):
327327
dt(2019, 9, 14, 8, 23, 0, 0),
328328
],
329329
],
330+
[
331+
# test "/n"
332+
["cron(*/10 14 * * *)"],
333+
[
334+
dt(2019, 9, 1, 14, 0, 0, 0),
335+
dt(2019, 9, 1, 14, 10, 0, 0),
336+
dt(2019, 9, 1, 14, 20, 0, 0),
337+
dt(2019, 9, 1, 14, 30, 0, 0),
338+
dt(2019, 9, 1, 14, 40, 0, 0),
339+
dt(2019, 9, 1, 14, 50, 0, 0),
340+
dt(2019, 9, 2, 14, 0, 0, 0),
341+
dt(2019, 9, 2, 14, 10, 0, 0),
342+
],
343+
],
344+
[
345+
# test "/n" spanning 2 hours
346+
["cron(*/30 14-15 * * *)"],
347+
[
348+
dt(2019, 9, 1, 14, 0, 0, 0),
349+
dt(2019, 9, 1, 14, 30, 0, 0),
350+
dt(2019, 9, 1, 15, 0, 0, 0),
351+
dt(2019, 9, 1, 15, 30, 0, 0),
352+
dt(2019, 9, 2, 14, 0, 0, 0),
353+
dt(2019, 9, 2, 14, 30, 0, 0),
354+
],
355+
],
356+
[
357+
# test optional 6th argument seconds
358+
["cron(0 14 * * * 10,35)"],
359+
[
360+
dt(2019, 9, 1, 14, 0, 10, 0),
361+
dt(2019, 9, 1, 14, 0, 35, 0),
362+
dt(2019, 9, 2, 14, 0, 10, 0),
363+
dt(2019, 9, 2, 14, 0, 35, 0),
364+
],
365+
],
330366
[
331367
# invalid cron expression returns None
332368
["cron(0 14 1-2-3 x *)"],

0 commit comments

Comments
 (0)