def _print_progress_message(self, test_name, test_status,
                             status_counters, progress,
                             mean_split_time, last_split_time,
                             params=None):
     counters = {}
     counters_format_parts = []
     for status in Status.stopped():
         counter_value = status_counters.get(status)
         if counter_value > 0:
             counters[status.value] = self.status_color(status) \
                                      + str(counter_value) \
                                      + self.RESET
             counters_format_parts.append("{{{s}}}".format(s=status.value))
     if counters_format_parts:
         counter_format = "|" + "|".join(f for f in counters_format_parts)
     else:
         counter_format = ""
     prefix_formatter = "[{progress:>4.0%}|{mean_split_time:.2f}ms" \
                        + counter_format \
                        + "] {test_status}: "
     suffix_formatter = " ({elapsed})"
     prefix = prefix_formatter.format(
         progress=progress,
         test_status=self.format_test_status(test_status),
         mean_split_time=timedelta_to_unit(mean_split_time,
                                           "ms"),
         **counters)
     if test_status != Status.RUNNING \
        and last_split_time is not None \
        and not params:
         suffix = suffix_formatter.format(
             elapsed=timedelta_to_hstr(last_split_time))
     else:
         suffix = ""
     printed_test_name = test_name+_format_subtest_params(params)
     self._printer.overwrite_message(prefix, printed_test_name,
                                     suffix, ellipse_index=1)
 def test_timedelta_to_unit(self):
     data = [
         (1000.0, timedelta(seconds=1), "ms"),
     ]
     for i, (a, q, u) in enumerate(data):
         self.assertEqual(a, timedelta_to_unit(q, u))