Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bell and minute rollover, add test case #15

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions test/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_time_operator(self):
assert t1 != 1
assert not t1 == 1

def test_rollover(self):
def test_positive_rollover(self):
et = EorzeaTime()
et.sun = 1
et.bell = 23
Expand All @@ -83,6 +83,37 @@ def test_rollover(self):
assert et.bell == 3
assert et.sun == 4

def test_negative_rollover(self):
et = EorzeaTime()
et.sun = 1
et.bell = 0
et.minute = 0

et.minute -= 1

assert et.minute == 59
assert et.bell == 23
assert et.sun == 32
assert et.moon == 1
assert et.year == 1070

et.minute -= 119

assert et.minute == 0
assert et.bell == 22

et.bell -= 48

assert et.minute == 0
assert et.bell == 22
assert et.sun == 30
assert et.moon == 1

et.moon -= 11

assert et.moon == 2
assert et.year == 1069

harbingerftw marked this conversation as resolved.
Show resolved Hide resolved
def test_property(self):
ts = 12700000
et = EorzeaTime(ts)
Expand All @@ -96,16 +127,6 @@ def test_property(self):
assert et.moon_phase == 0.50
assert et.moon_name == "Sixth Embral Moon"

et = EorzeaTime()
et.moon += 13
et.sun += 33
et.bell += 26
et.minute += 65
et.moon -= 13
et.sun -= 33
et.bell -= 26
et.minute -= 65

def test_repr(self):
et = EorzeaTime.now()
assert repr(et) == f"EorzeaTime({et.get_unix_time()})"
Expand Down