Count days and seasons by calendar day

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-19 09:42:36 +01:00
parent 75327f30e0
commit 70246f78ea
3 changed files with 23 additions and 4 deletions

View file

@ -848,6 +848,14 @@ class HappeningsTest(unittest.TestCase):
self.assertEqual(game.season(self.world, T0 + 8 * game.DAY)["name"], "Summer")
self.assertEqual(game.season(self.world, T0 + 22 * game.DAY)["name"], "Winter")
def test_days_count_midnights_not_24_hour_stretches(self):
from datetime import datetime
late = datetime(2026, 10, 18, 23, 0).timestamp()
world = game.new_world(late)
self.assertEqual(game.calendar_day(world, late + 1800), 0) # 23:30 the same evening
self.assertEqual(game.calendar_day(world, late + 2 * 3600), 1) # 01:00 the next morning
self.assertEqual(game.season(world, late + 2 * 3600)["day"], 2)
def test_weather_changes_skill_speed(self):
p = self.world["players"]["ann"]
farm = game.ACTION_BY_ID["farm_wheat"]