changeset 2371:a05e01144a2c beta

fixed stupid test condition
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 02 Jun 2012 00:10:11 +0200
parents 889cda9c2d14
children 95bea8088213
files rhodecode/tests/test_libs.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/tests/test_libs.py	Fri Jun 01 23:47:16 2012 +0200
+++ b/rhodecode/tests/test_libs.py	Sat Jun 02 00:10:11 2012 +0200
@@ -118,6 +118,7 @@
         self.assertEqual(s, extract_mentioned_users(sample))
 
     def test_age(self):
+        import calendar
         from rhodecode.lib.utils2 import age
         n = datetime.datetime.now()
         delt = lambda *args, **kwargs: datetime.timedelta(*args, **kwargs)
@@ -127,5 +128,6 @@
         self.assertEqual(age(n - delt(hours=1)), u'1 hour ago')
         self.assertEqual(age(n - delt(hours=24)), u'1 day ago')
         self.assertEqual(age(n - delt(hours=24 * 5)), u'5 days ago')
-        self.assertEqual(age(n - delt(hours=24 * 32)), u'1 month and 2 days ago')
+        self.assertEqual(age(n - delt(hours=24 * (calendar.mdays[n.month-1] + 2))),
+                         u'1 month and 2 days ago')
         self.assertEqual(age(n - delt(hours=24 * 400)), u'1 year and 1 month ago')