commaAndified timeElapsed.

This commit is contained in:
Jeremy Fincher 2003-08-21 16:31:11 +00:00
parent 526e5b613b
commit 6bfd991947
2 changed files with 3 additions and 3 deletions

View File

@ -164,7 +164,7 @@ def timeElapsed(elapsed, leadingZeroes=False, years=True, weeks=True,
if len(ret) == 1:
return ret[0]
else:
return ' and '.join([', '.join(ret[:-1]), ret[-1]])
return commaAndify(ret)
def distance(s, t):
"""Returns the levenshtein edit distance between two strings."""

View File

@ -45,8 +45,8 @@ class UtilsTest(unittest.TestCase):
(61, '1 minute and 1 second'),
(62, '1 minute and 2 seconds'),
(122, '2 minutes and 2 seconds'),
(3722, '1 hour, 2 minutes and 2 seconds'),
(7322, '2 hours, 2 minutes and 2 seconds')]:
(3722, '1 hour, 2 minutes, and 2 seconds'),
(7322, '2 hours, 2 minutes, and 2 seconds')]:
self.assertEqual(utils.timeElapsed(now - then), expected)
def testEachSubstring(self):