# HG changeset patch # User Marcin Kuzminski # Date 2012-06-02 00:10:11 # Node ID a05e01144a2c5e5646a0038edecf253f13157936 # Parent 889cda9c2d141c2f6fe0fa2c83a012c7f27b33fc fixed stupid test condition diff --git a/rhodecode/tests/test_libs.py b/rhodecode/tests/test_libs.py --- a/rhodecode/tests/test_libs.py +++ b/rhodecode/tests/test_libs.py @@ -118,6 +118,7 @@ class TestLibs(unittest.TestCase): 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 @@ class TestLibs(unittest.TestCase): 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')