From 5d35a6e0ce6b96b37843a0e8f0fa52f3d015cb10 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 22 Apr 2015 07:36:24 -0400 Subject: Make datetime imperviousness work on 2.6 --- tests/test_html.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_html.py b/tests/test_html.py index 2de6b68e..6f0b294a 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -387,12 +387,14 @@ class HtmlTest(HtmlTestHelpers, CoverageTest): self.assertTrue(m, "Didn't find a timestamp!") timestamp = datetime.datetime(*map(int, m.groups())) age = datetime.datetime.now() - timestamp + # Python2.6 doesn't have total_seconds :( + self.assertEqual(age.days, 0) # The timestamp only records the minute, so the delta could be from # 12:00 to 12:01:59, or two minutes. self.assertLessEqual( - abs(age.total_seconds()), + abs(age.seconds), 120, - "Timestamp is wrong: {}".format(timestamp) + "Timestamp is wrong: {0}".format(timestamp) ) -- cgit v1.2.1