File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ def humanize_runtime(time_in_ns: int) -> str:
2424 runtime_human = "%.3g" % (time_micro / (1000 ** 2 ))
2525 elif units in {"minutes" , "minute" }:
2626 runtime_human = "%.3g" % (time_micro / (60 * 1000 ** 2 ))
27- else : # hours
27+ elif units in { "hour" , "hours" }: # hours
2828 runtime_human = "%.3g" % (time_micro / (3600 * 1000 ** 2 ))
29-
29+ else : #days
30+ runtime_human = "%.3g" % (time_micro / (24 * 3600 * 1000 ** 2 ))
3031 runtime_human_parts = str (runtime_human ).split ("." )
3132 if len (runtime_human_parts [0 ]) == 1 :
3233 if len (runtime_human_parts ) == 1 :
Original file line number Diff line number Diff line change @@ -25,3 +25,5 @@ def test_humanize_runtime():
2525 assert humanize_runtime (123456789123 ) == "2.06 minutes"
2626 assert humanize_runtime (1234567891234 ) == "20.6 minutes"
2727 assert humanize_runtime (12345678912345 ) == "3.43 hours"
28+ assert humanize_runtime (98765431298760 ) == "1.14 day"
29+ assert humanize_runtime (197530862597520 ) == "2.29 days"
You can’t perform that action at this time.
0 commit comments