mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix issue in validatorfuncs.timedelta() in which days and years (in days) aren't added to create datetime.timedelta(days=days, ...)
This commit is contained in:
parent
fffa1937e5
commit
56ab5d32a5
1 changed files with 7 additions and 4 deletions
|
|
@ -44,10 +44,13 @@ class TestValidatorFuncs(TestCase):
|
|||
self.assertTrue(
|
||||
isinstance(validatorfuncs.duration(d), datetime.timedelta))
|
||||
|
||||
# THE FOLLOWING FAILS, year calculation seems to be incorrect
|
||||
# self.assertEqual(
|
||||
# datetime.timedelta(1+5*365, 2, 0, 0, 3, 4, 5),
|
||||
# validatorfuncs.duration('1d 2s 3m 4h 5w 5y'))
|
||||
self.assertEqual(
|
||||
datetime.timedelta(1+6*365, 2, 0, 0, 3, 4, 5),
|
||||
validatorfuncs.duration('1d 2s 3m 4h 5w 6y'))
|
||||
# values may be duplicated
|
||||
self.assertEqual(
|
||||
datetime.timedelta((1+7)+(6+12)*365, 2+8, 0, 0, 3+9, 4+10, 5+11),
|
||||
validatorfuncs.duration('1d 2s 3m 4h 5w 6y 7d 8s 9m 10h 11w 12y'))
|
||||
|
||||
def test_duration_raises_ValueError(self):
|
||||
for d in ['', '1', '5days', '1Week']:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue