Private
Public Access
1
0

better totaltimetosec

This commit is contained in:
Sander Roosendaal
2022-09-28 19:13:56 +02:00
parent 469363c691
commit 1c40d31c9c
3 changed files with 69 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ from __future__ import unicode_literals
from .statements import *
from rowers.mytypes import rowtypes
from rowers.utils import allmonths,allsundays
from rowers.utils import allmonths,allsundays, totaltime_sec_to_string
from rowers.models import update_records
from django.db import transaction
@@ -94,6 +94,25 @@ class OtherUnitTests(TestCase):
# time zone should be US/Pacific
self.assertTrue('US/Pacific' in str(startdate.tzinfo))
def test_totaltime_sec_to_string(self):
results = (
(0,"0:00"),
(120,"2:00"),
(3634.2,"1:00:34"),
)
for duration, expected in results:
self.assertEqual(totaltime_sec_to_string(duration, shorten=True), expected)
results = (
(0,"00:00:00.0"),
(120,"00:02:00.0"),
(3634.2,"01:00:34.2"),
)
for duration, expected in results:
self.assertEqual(totaltime_sec_to_string(duration, shorten=False), expected)
def test_summaryfromsplitdata(self):