code: def test_Matrix_inv(name, A, A_inv, den):
      def _check(**kwargs):
          if den != 0:
              assert A.inv(**kwargs) == A_inv
          else:
              raises(NonInvertibleMatrixError, lambda: A.inv(**kwargs))
  
      K = A.domain
      A = A.to_Matrix()
      A_inv = A_inv.to_Matrix() / K.to_sympy(den)
      _check()
      for method in ["GE", "LU", "ADJ", "CH", "LDL", "QR"]:
          _check(method=method)
  
file_path: sympy/sympy/polys/matrices/tests/test_inverse.py
imports: from sympy import ZZ
  from sympy.polys.matrices import DM, DomainMatrix
  from sympy.polys.matrices.dense import ddm_iinv
  from sympy.polys.matrices.exceptions import DMNonInvertibleMatrixError
  from sympy.matrices.exceptions import NonInvertibleMatrixError
  import pytest
  from sympy.testing.pytest import raises
label_desc: Use image node_id 1 for calling a global function with example usage: test_Matrix_inv(name, A, A_inv, den) without return types