code: def test_ndarray_transpose():
      np_v = np.array([1, 2, 3])
      np_m = np.array([[1, 2, 3], [4, 5, 6]])
      np_cube = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
      v = hl.nd.array(np_v)
      m = hl.nd.array(np_m)
      cube = hl.nd.array(np_cube)
  
      assert_ndarrays_eq(
          (v.T, np_v.T),
          (v.T, np_v),
          (m.T, np_m.T),
          (cube.transpose((0, 2, 1)), np_cube.transpose((0, 2, 1))),
          (cube.T, np_cube.T),
      )
  
      assert hl.eval(hl.missing(hl.tndarray(hl.tfloat, 1)).T) is None
  
      with pytest.raises(ValueError) as exc:
          v.transpose((1,))
      assert "Invalid axis: 1" in str(exc.value)
  
      with pytest.raises(ValueError) as exc:
          cube.transpose((1, 1))
      assert "Expected 3 axes, got 2" in str(exc.value)
  
      with pytest.raises(ValueError) as exc:
          cube.transpose((1, 1, 1))
      assert "Axes cannot contain duplicates" in str(exc.value)
  
imports: import math
  import numpy
  import re
  from ..helpers import *
  import pytest
  from hail.utils.java import FatalError, HailUserError
label_desc: Use image node_id 14 for calling a global function with example usage: test_ndarray_transpose() without return types