phase-of-the-moon/tests/test_phase_of_the_moon.py

24 lines
717 B
Python
Raw Permalink Normal View History

2024-11-01 21:30:04 +00:00
# Copyright 2024 Zoé Cassiopée Gauthier.
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import datetime as dt
from phase_of_the_moon.main import phase_of_the_moon, NEW_MOON, FULL_MOON
def test_new_moon():
local_time = dt.datetime(1996, 9, 13)
assert phase_of_the_moon(local_time) == NEW_MOON
def test_full_moon():
local_time = dt.datetime(1998, 3, 13)
assert phase_of_the_moon(local_time) == FULL_MOON
def test_any_other_moon_phase():
local_time = dt.datetime(2000, 1, 1)
moon_phase = phase_of_the_moon(local_time)
assert moon_phase != FULL_MOON
assert moon_phase != NEW_MOON