Skip to content

Commit

Permalink
Add tests for udatetime.
Browse files Browse the repository at this point in the history
  • Loading branch information
kipe committed Dec 30, 2017
1 parent cd8993b commit b6a8ed8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ coverage>=4.4.2
coveralls>=1.2.0
pendulum>=1.3.2
pytz>=2017.3
udatetime>=0.0.14
2 changes: 2 additions & 0 deletions tests/test_dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pytz import utc
import pendulum
import arrow
import udatetime


def test_dom():
Expand All @@ -23,3 +24,4 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))
3 changes: 3 additions & 0 deletions tests/test_dow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pytz import utc
import pendulum
import arrow
import udatetime


def test_dow():
Expand All @@ -24,6 +25,7 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))


def test_day_matching():
Expand All @@ -44,3 +46,4 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))
5 changes: 5 additions & 0 deletions tests/test_has_been.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pycron
import pendulum
import arrow
import udatetime


def test_minutes():
Expand All @@ -21,6 +22,7 @@ def run(since, now):
run(since.replace(tzinfo=utc), now.replace(tzinfo=utc))
run(pendulum.instance(since), pendulum.instance(now))
run(arrow.get(since), arrow.get(now))
run(udatetime.from_string(since.isoformat()), udatetime.from_string(now.isoformat()))


def test_hours():
Expand All @@ -38,6 +40,7 @@ def run(since, now):
run(since.replace(tzinfo=utc), now.replace(tzinfo=utc))
run(pendulum.instance(since), pendulum.instance(now))
run(arrow.get(since), arrow.get(now))
run(udatetime.from_string(since.isoformat()), udatetime.from_string(now.isoformat()))


def test_days():
Expand All @@ -55,6 +58,7 @@ def run(since, now):
run(since.replace(tzinfo=utc), now.replace(tzinfo=utc))
run(pendulum.instance(since), pendulum.instance(now))
run(arrow.get(since), arrow.get(now))
run(udatetime.from_string(since.isoformat()), udatetime.from_string(now.isoformat()))


def test_raises():
Expand All @@ -63,6 +67,7 @@ def test_raises():
assert_raises(ValueError, pycron.has_been, '* * * * *', since, now)
assert_raises(ValueError, pycron.has_been, '* * * * *', pendulum.instance(since), pendulum.instance(now))
assert_raises(ValueError, pycron.has_been, '* * * * *', arrow.get(since), arrow.get(now))
assert_raises(ValueError, pycron.has_been, '* * * * *', udatetime.from_string(since.isoformat()), udatetime.from_string(now.isoformat()))


def test_timezone():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_hour.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pytz import utc
import pendulum
import arrow
import udatetime


def test_hour():
Expand All @@ -27,3 +28,4 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))
2 changes: 2 additions & 0 deletions tests/test_minute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pytz import utc
import pendulum
import arrow
import udatetime


def test_minute():
Expand Down Expand Up @@ -31,3 +32,4 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))
2 changes: 2 additions & 0 deletions tests/test_month.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pytz import utc
import pendulum
import arrow
import udatetime


def test_parser():
Expand All @@ -23,3 +24,4 @@ def run(now):
run(now.replace(tzinfo=utc))
run(pendulum.instance(now))
run(arrow.get(now))
run(udatetime.from_string(now.isoformat()))

0 comments on commit b6a8ed8

Please sign in to comment.