You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
531 B

  1. from datetime import timedelta as td
  2. from django.test import TestCase
  3. from hc.lib.date import format_mins_secs
  4. class DateFormattingTestCase(TestCase):
  5. def test_mins_secs_work(self):
  6. s = format_mins_secs(td(seconds=0))
  7. self.assertEqual(s, "0 sec")
  8. s = format_mins_secs(td(seconds=1))
  9. self.assertEqual(s, "1 sec")
  10. s = format_mins_secs(td(seconds=61))
  11. self.assertEqual(s, "1 min 1 sec")
  12. s = format_mins_secs(td(seconds=62))
  13. self.assertEqual(s, "1 min 2 sec")