code: def test_sparse():
      sparse_array = MutableSparseNDimArray([0, 0, 0, 1], (2, 2))
      assert len(sparse_array) == 2 * 2
      # dictionary where all data is, only non-zero entries are actually stored:
      assert len(sparse_array._sparse_array) == 1
  
      assert sparse_array.tolist() == [[0, 0], [0, 1]]
  
      for i, j in zip(sparse_array, [[0, 0], [0, 1]]):
          assert i == MutableSparseNDimArray(j)
  
      sparse_array[0, 0] = 123
      assert len(sparse_array._sparse_array) == 2
      assert sparse_array[0, 0] == 123
      assert sparse_array / 0 == MutableSparseNDimArray(
          [[S.ComplexInfinity, S.NaN], [S.NaN, S.ComplexInfinity]],
          (2, 2),
      )
  
      # when element in sparse array become zero it will disappear from
      # dictionary
      sparse_array[0, 0] = 0
      assert len(sparse_array._sparse_array) == 1
      sparse_array[1, 1] = 0
      assert len(sparse_array._sparse_array) == 0
      assert sparse_array[0, 0] == 0
  
      # test for large scale sparse array
      # equality test
      a = MutableSparseNDimArray.zeros(100000, 200000)
      b = MutableSparseNDimArray.zeros(100000, 200000)
      assert a == b
      a[1, 1] = 1
      b[1, 1] = 2
      assert a != b
  
      # __mul__ and __rmul__
      assert a * 3 == MutableSparseNDimArray(
          {200001: 3}, (100000, 200000)
      )
      assert 3 * a == MutableSparseNDimArray(
          {200001: 3}, (100000, 200000)
      )
      assert a * 0 == MutableSparseNDimArray({}, (100000, 200000))
      assert 0 * a == MutableSparseNDimArray({}, (100000, 200000))
  
      # __truediv__
      assert a / 3 == MutableSparseNDimArray(
          {200001: Rational(1, 3)}, (100000, 200000)
      )
  
      # __neg__
      assert -a == MutableSparseNDimArray(
          {200001: -1}, (100000, 200000)
      )
  
imports: from copy import copy
  from sympy.tensor.array.dense_ndim_array import MutableDenseNDimArray
  from sympy.core.function import diff
  from sympy.core.numbers import Rational
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol
  from sympy.core.sympify import sympify
  from sympy.matrices import SparseMatrix
  from sympy.matrices import Matrix
  from sympy.tensor.array.sparse_ndim_array import MutableSparseNDimArray
  from sympy.testing.pytest import raises
label_desc: Use image node_id 6 for calling a global function with example usage: test_sparse() without return types