Skip to content

Commit 2ca34dd

Browse files
committed
tests: Adjust expectations for 2.6.0+ for eoy datetime
In 2.5.2 and 2.5.3, the meaning of "end of X" named dates temporarily changed to be equivalend to "start of X+1". This was reverted back in 2.6.0 to the "start of X+1 minus 1 second".
1 parent d1b0f8d commit 2ca34dd

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

tasklib/tests.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,21 +1229,21 @@ def test_simple_eoy_conversion(self):
12291229
t = Task(self.tw, description='test task', due='eoy')
12301230
now = local_zone.localize(datetime.datetime.now())
12311231
eoy = local_zone.localize(datetime.datetime(
1232-
year=now.year+1,
1233-
month=1,
1234-
day=1,
1235-
hour=0,
1236-
minute=0,
1237-
second=0,
1232+
year=now.year,
1233+
month=12,
1234+
day=31,
1235+
hour=23,
1236+
minute=59,
1237+
second=59,
12381238
))
1239-
if self.tw.version < '2.5.2':
1239+
if self.tw.version >= '2.5.2' and self.tw.version < '2.6.0':
12401240
eoy = local_zone.localize(datetime.datetime(
1241-
year=now.year,
1242-
month=12,
1243-
day=31,
1244-
hour=23,
1245-
minute=59,
1246-
second=59,
1241+
year=now.year+1,
1242+
month=1,
1243+
day=1,
1244+
hour=0,
1245+
minute=0,
1246+
second=0,
12471247
))
12481248
self.assertEqual(eoy, t['due'])
12491249

@@ -1260,23 +1260,23 @@ def test_complex_eoy_conversion(self):
12601260
now = local_zone.localize(datetime.datetime.now())
12611261
due_date = local_zone.localize(
12621262
datetime.datetime(
1263-
year=now.year+1,
1264-
month=1,
1265-
day=1,
1266-
hour=0,
1267-
minute=0,
1268-
second=0,
1263+
year=now.year,
1264+
month=12,
1265+
day=31,
1266+
hour=23,
1267+
minute=59,
1268+
second=59,
12691269
)
12701270
) - datetime.timedelta(0, 4 * 30 * 86400)
1271-
if self.tw.version < '2.5.2':
1271+
if self.tw.version >= '2.5.2' and self.tw.version < '2.6.0':
12721272
due_date = local_zone.localize(
12731273
datetime.datetime(
1274-
year=now.year,
1275-
month=12,
1276-
day=31,
1277-
hour=23,
1278-
minute=59,
1279-
second=59,
1274+
year=now.year+1,
1275+
month=1,
1276+
day=1,
1277+
hour=0,
1278+
minute=0,
1279+
second=0,
12801280
)
12811281
) - datetime.timedelta(0, 4 * 30 * 86400)
12821282
self.assertEqual(due_date, t['due'])

0 commit comments

Comments
 (0)