-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from mguentner/fullmoon
report/log: add lunar start time options 🌔
- Loading branch information
Showing
7 changed files
with
299 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Unit test for the 'fullmoon' helper""" | ||
|
||
import arrow | ||
import pytest | ||
|
||
from watson.fullmoon import get_last_full_moon | ||
|
||
|
||
def test_with_known_date(): | ||
aniceday = arrow.Arrow(2018, 7, 27, 10, 51) | ||
aniceday_lastMoon = arrow.Arrow(2018, 6, 28, 4, 55) | ||
aniceday_result = get_last_full_moon(aniceday) | ||
assert aniceday_result == aniceday_lastMoon | ||
thenextday = aniceday.shift(days=1) | ||
thenextday_lastMoon = arrow.Arrow(2018, 7, 27, 20, 22) | ||
thenextday_result = get_last_full_moon(thenextday) | ||
assert thenextday_result == thenextday_lastMoon | ||
|
||
|
||
def test_invalid_ranges(): | ||
fail = arrow.Arrow(1970, 1, 1) | ||
fail2 = arrow.Arrow(2100, 5, 5) | ||
with pytest.raises(ValueError): | ||
get_last_full_moon(fail) | ||
with pytest.raises(ValueError): | ||
get_last_full_moon(fail2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.