testing for bug found in gametime module

I've found a bug in the gametime module where if your date is the
year before a leap year, and the real_seconds_until function has
to adjust the date (from using an earlier month) over that leap
year, the calculation is off a day since the current function uses
the length of the current year to determine how far to skip ahead

I've changed the current test to *not* test for this bug in the
mainline test (before it was passing because I was using the output
from the current function to determine correctness) and to add a
separate test that is marked as an expected failure for now. I am
working on a fix but it is outside the scope of this PR.
This commit is contained in:
Chason Chaffin 2019-04-19 12:49:27 +09:00
parent 552146db5c
commit 7ebd6a9f0e

View file

@ -3,6 +3,7 @@ Unit tests for the utilities of the evennia.utils.gametime module.
"""
import time
import unittest
from unittest.mock import Mock
from django.conf import settings
@ -75,7 +76,11 @@ class TestGametime(TestCase):
self.assertAlmostEqual(gametime.real_seconds_until(min=30), 708)
self.assertAlmostEqual(gametime.real_seconds_until(hour=13), 16560)
self.assertAlmostEqual(gametime.real_seconds_until(day=17), 501120)
self.assertAlmostEqual(gametime.real_seconds_until(month=3), 5771520)
self.assertAlmostEqual(gametime.real_seconds_until(month=1), 4752000)
@unittest.expectedFailure
def test_real_seconds_until_leap_year(self):
self.assertAlmostEqual(gametime.real_seconds_until(month=3), 5788800)
def test_schedule(self):
callback = Mock()