code: def test_switch(self):  # verify data types
      for data in (
          np.zeros((2, 1)),
          ("test",),
          [24, 42],
          {"foo": "bar"},
          True,
          42,
      ):
          output = switch_endianness(data, "<")
          self.assertEqual(type(data), type(output))
  
      before = np.array((20, 20), dtype=">i2")
      expected_float = before.astype(float)
      after = switch_endianness(before)
      np.testing.assert_allclose(after.astype(float), expected_float)
      self.assertEqual(after.dtype.byteorder, "<")
  
      before = np.array((20, 20), dtype="<i2")
      expected_float = before.astype(float)
      after = switch_endianness(before)
      np.testing.assert_allclose(after.astype(float), expected_float)
  
      before = np.array(["1.12", "-9.2", "42"], dtype=np.string_)
      after = switch_endianness(before)
      np.testing.assert_array_equal(before, after)
  
      with self.assertRaises(NotImplementedError):
          switch_endianness(np.zeros((2, 1)), "=")
  
      with self.assertRaises(RuntimeError):
          switch_endianness(Path("test"), "<")
  
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  from pathlib import Path
  from typing import TYPE_CHECKING
  from unittest.case import skipUnless
  import numpy
  from parameterized import parameterized
  from monai.data import DataLoader, Dataset, create_test_image_2d
  from monai.data.image_reader import PILReader
  from monai.transforms import LoadImage, LoadImaged
  from monai.transforms.io.array import switch_endianness
  from monai.utils.enums import PostFix
  from monai.utils.module import optional_import
label_desc: Use image node_id 3 for calling the TestNiftiEndianness obj's underlying member method code with example usage: obj.test_switch() without return types