code: def test_fit_active_phase(self) -> None:
      tc = unittest.TestCase()
  
      class PhaseTestCallback(Callback):
          def on_train_step_end(
              self, state: State, unit: TTrainUnit
          ) -> None:
              tc.assertEqual(state.active_phase, ActivePhase.TRAIN)
  
          def on_train_end(
              self, state: State, unit: TTrainUnit
          ) -> None:
              tc.assertEqual(state.active_phase, ActivePhase.TRAIN)
  
      input_dim = 2
      dataset_len = 8
      batch_size = 2
      evaluate_every_n_steps = 2
      evaluate_every_n_epochs = 1
      max_epochs = 2
  
      my_unit = DummyFitUnit(input_dim)
  
      train_dl = generate_random_dataloader(
          dataset_len, input_dim, batch_size
      )
      eval_dl = generate_random_dataloader(
          dataset_len, input_dim, batch_size
      )
      fit(
          my_unit,
          train_dataloader=train_dl,
          eval_dataloader=eval_dl,
          evaluate_every_n_steps=evaluate_every_n_steps,
          evaluate_every_n_epochs=evaluate_every_n_epochs,
          max_epochs=max_epochs,
          callbacks=[PhaseTestCallback()],
      )
  
imports: import math
  import unittest
  from typing import Tuple
  from unittest.mock import MagicMock
  import torch
  from torch import nn
  from torchtnt.framework._test_utils import DummyFitUnit, generate_random_dataloader
  from torchtnt.framework.callback import Callback
  from torchtnt.framework.fit import fit
  from torchtnt.framework.state import ActivePhase, State
  from torchtnt.framework.unit import EvalUnit, TrainUnit, TTrainUnit
  from torchtnt.utils.timer import Timer
label_desc: Use image node_id 6 for calling the FitTest obj's underlying member method code with example usage: obj.test_fit_active_phase() without return types