Skip to content

Commit

Permalink
Added unit test for replace_names
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrmsn committed May 29, 2023
1 parent e327a2f commit 33686d0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/test_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dateutil import rrule

from cron_validator.util import str_to_datetime
from cron_validator.util import replace_names, str_to_datetime

tz_name = "Asia/Ho_Chi_Minh"
utc_tz = "UTC"
Expand Down Expand Up @@ -33,3 +33,12 @@ def test_iterator_day():
assert delta.total_seconds() < 0
for dt in rrule.rrule(rrule.MINUTELY, dtstart=dt1, until=dt2):
print(dt)


def test_replace_names():
assert replace_names("* * * */2,3 6") == "* * * */2,3 6"
assert replace_names("* * * may fri") == "* * * 5 5"
assert replace_names("* * * jan-sep,nov mon/2") == "* * * 1-9,11 1/2"
assert replace_names("* * * feb,aug,oct tue,WED,sAT") == "* * * 2,8,10 2,3,6"
assert replace_names("* * * MAR-apr thu-fri") == "* * * 3-4 4-5"
assert replace_names("* * * mAy,jun,JUL-DEC SUN/3") == "* * * 5,6,7-12 0/3"

0 comments on commit 33686d0

Please sign in to comment.