code: def test_trace():
      assert SparseMatrix(((1, 2), (3, 4))).trace() == 5
      assert SparseMatrix(((0, 0), (0, 4))).trace() == 4
  
imports: from sympy.core.numbers import Float, I, Rational
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.complexes import Abs
  from sympy.polys.polytools import PurePoly
  from sympy.matrices import Matrix, MutableSparseMatrix, ImmutableSparseMatrix, SparseMatrix, eye, ones, zeros, ShapeError, NonSquareMatrixError
  from sympy.testing.pytest import raises
label_desc: Use image node_id 5 for calling a global function with example usage: test_trace() without return types