code: def assert_fields_are_equal(
      test: parameterized.TestCase,
      expected,  # todo rename
      actual,
      field_name: str,
      delta=1e-5,
  ):
      if expected == actual:
          return
      if expected is None:
          test.assertIsNone(
              actual, msg=f"{field_name} is expected tp be None."
          )
      elif isinstance(expected, int) or isinstance(expected, enum.Enum):
          test.assertEquals(
              expected,
              actual,
              msg=f"expected={expected} and actual={actual} differ in {field_name}",
          )
      elif isinstance(expected, float):
          test.assertAlmostEqual(
              expected,
              actual,
              delta=delta,
              msg=f"expected={expected} and actual={actual} differ in {field_name}",
          )
      elif isinstance(expected, typing.List):
          for i, (exp_i, act_i) in enumerate(zip(expected, actual)):
              assert_fields_are_equal(
                  test, exp_i, act_i, f"{field_name}[{i}]", delta
              )
      elif isinstance(expected, typing.Dict):
          assert_dictionaries_are_equal(test, expected, actual, delta)
      else:
          raise Exception(
              f"assert_dataclasses_are_equal only supports dataclasses with "
              f"int, float, List[int], List[float] or enum fields. Got "
              f"f1={field_name} with type={type(actual)} instead"
          )
  
imports: import dataclasses
  import enum
  import typing
  from absl.testing import parameterized
label_desc: Use image node_id 2 for calling a global function with example usage: assert_fields_are_equal(test, expected, actual, field_name, delta) without return types