code: def _a_valid_loop(
      self,
      epoch_number,
      num_steps: int = 5,
      with_progress_bar: bool = True,
      show_every_n_steps: Union[str, int] = "all",
  ) -> List:
      color_progress_calls = []
  
      self.progression_callback.on_valid_begin(self.an_empty_log)
      if with_progress_bar:
          color_progress_calls.append(
              call().set_progress_bar(self.num_steps)
          )
      else:
          color_progress_calls.append(call().close_progress_bar())
      color_progress_calls.append(call().on_valid_begin())
  
      step_times_weighted_sum = 0.0
      for valid_batch_number in range(1, num_steps + 1):
          do_print = show_every_n_steps == "all" or (
              isinstance(show_every_n_steps, int)
              and valid_batch_number % show_every_n_steps == 0
          )
          self.progression_callback.on_valid_batch_end(
              valid_batch_number, self.any_log
          )
  
          if with_progress_bar:
              remaining_time = self.step_times_rate * (
                  self.num_steps - valid_batch_number
              )
  
              color_progress_calls.append(
                  call().on_valid_batch_end(
                      remaining_time=remaining_time,
                      batch_number=valid_batch_number,
                      metrics_str=self.metrics_str,
                      steps=self.num_valid_steps,
                      do_print=do_print,
                  )
              )
          else:
              step_times_weighted_sum += (
                  valid_batch_number * self.step_times_rate
              )
              normalizing_factor = (
                  valid_batch_number * (valid_batch_number + 1)
              ) / 2
              step_times_rate = (
                  step_times_weighted_sum / normalizing_factor
              )
  
              color_progress_calls.append(
                  call().on_valid_batch_end(
                      remaining_time=step_times_rate,
                      batch_number=valid_batch_number,
                      metrics_str=self.metrics_str,
                      do_print=do_print,
                  )
              )
  
      self.progression_callback.on_valid_end(self.final_log)
      self.progression_callback.on_epoch_end(
          epoch_number, self.final_log
      )
  
      color_progress_calls.append(
          call().on_epoch_end(
              total_time=self.total_time,
              train_last_steps=self.num_steps,
              valid_last_steps=self.num_valid_steps,
              metrics_str=self.metrics_str,
          )
      )
  
      return color_progress_calls
  
file_path: poutyne/tests/framework/callbacks/test_progress.py
imports: from typing import List, Union
  from unittest import TestCase
  from unittest.mock import MagicMock, call, patch
  from poutyne import ProgressionCallback
label_desc: Use image node_id 8 for calling the ProgressTest obj's underlying member method code with example usage: obj._a_valid_loop(epoch_number, num_steps, with_progress_bar, show_every_n_steps) and returns: color_progress_calls