code: def test_inv():
      np.random.seed(0)
      n = 10
      p = Rotation.from_quat(np.random.normal(size=(n, 4)))
      q = p.inv()
  
      p_dcm = p.as_dcm()
      q_dcm = q.as_dcm()
      result1 = np.einsum("...ij,...jk->...ik", p_dcm, q_dcm)
      result2 = np.einsum("...ij,...jk->...ik", q_dcm, p_dcm)
  
      eye3d = np.empty((n, 3, 3))
      eye3d[:] = np.eye(3)
  
      assert_array_almost_equal(result1, eye3d)
      assert_array_almost_equal(result2, eye3d)
  
imports: from __future__ import division, print_function, absolute_import
  import pytest
  import numpy
  from numpy.testing import assert_equal, assert_array_almost_equal
  from numpy.testing import assert_allclose
  from scipy.spatial.transform import Rotation, Slerp
  from scipy.stats import special_ortho_group
  from itertools import permutations
label_desc: Use image node_id 39 for calling a global function with example usage: test_inv() without return types