Skip to content

Commit

Permalink
Add additional tests for minute ranges (issue kipe#14).
Browse files Browse the repository at this point in the history
  • Loading branch information
khuoman-gef committed Jul 23, 2018
1 parent a97909c commit 5b429c9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_minute.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@ def run(now):
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))
run(Delorean(datetime=now, timezone='UTC').datetime)


def test_minute_ranges():
for i in range(1, 59, 2):
now = datetime(2015, 6, 18, 0, i)
assert pycron.is_now('1-59/2 * * * *', now)
assert pycron.is_now('1-59/2 * * * *', now.replace(tzinfo=utc))
assert pycron.is_now('1-59/2 * * * *', pendulum.instance(now))
assert pycron.is_now('1-59/2 * * * *', arrow.get(now))
assert pycron.is_now('1-59/2 * * * *', udatetime.from_string(now.isoformat()))
assert pycron.is_now('1-59/2 * * * *', Delorean(datetime=now, timezone='UTC').datetime)

for i in range(0, 59, 2):
now = datetime(2015, 6, 18, 0, i)
assert pycron.is_now('1-59/2 * * * *', now) is False
assert pycron.is_now('1-59/2 * * * *', now.replace(tzinfo=utc)) is False
assert pycron.is_now('1-59/2 * * * *', pendulum.instance(now)) is False
assert pycron.is_now('1-59/2 * * * *', arrow.get(now)) is False
assert pycron.is_now('1-59/2 * * * *', udatetime.from_string(now.isoformat())) is False
assert pycron.is_now('1-59/2 * * * *', Delorean(datetime=now, timezone='UTC').datetime) is False

0 comments on commit 5b429c9

Please sign in to comment.