code: def test_shape(
      self, input_data, expected_shape, expected_result=None
  ):
      result = one_hot(**input_data)
      self.assertEqual(result.shape, expected_shape)
      if expected_result is not None:
          self.assertTrue(np.allclose(expected_result, result.numpy()))
  
      if "dtype" in input_data:
          self.assertEqual(result.dtype, input_data["dtype"])
      else:
          # by default, expecting float type
          self.assertEqual(result.dtype, torch.float)
  
file_path: MONAI/tests/test_to_onehot.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.networks import one_hot
label_desc: Use image node_id 1 for calling the TestToOneHot obj's underlying member method code with example usage: obj.test_shape(input_data, expected_shape, expected_result) without return types