code: def test_eye(self, eye):
      assert_equal(eye(1, 1).toarray(), [[1]])
      assert_equal(eye(2, 3).toarray(), [[1, 0, 0], [0, 1, 0]])
      assert_equal(eye(3, 2).toarray(), [[1, 0], [0, 1], [0, 0]])
      assert_equal(
          eye(3, 3).toarray(), [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
      )
  
      assert_equal(eye(3, 3, dtype="int16").dtype, np.dtype("int16"))
  
      for m in [3, 5]:
          for n in [3, 5]:
              for k in range(-5, 6):
                  # scipy.sparse.eye deviates from np.eye here. np.eye will
                  # create arrays of all 0's when the diagonal offset is
                  # greater than the size of the array. For sparse arrays
                  # this makes less sense, especially as it results in dia
                  # arrays with negative diagonals. Therefore sp.sparse.eye
                  # validates that diagonal offsets fall within the shape of
                  # the array. See gh-18555.
                  if (k > 0 and k > n) or (k < 0 and abs(k) > m):
                      with pytest.raises(
                          ValueError, match="Offset.*out of bounds"
                      ):
                          eye(m, n, k=k)
  
                  else:
                      assert_equal(
                          eye(m, n, k=k).toarray(), np.eye(m, n, k=k)
                      )
                      if m == n:
                          assert_equal(
                              eye(m, k=k).toarray(), np.eye(m, n, k=k)
                          )
  
imports: import numpy
  from numpy import array
  from numpy.testing import assert_equal, assert_, assert_array_equal, assert_array_almost_equal_nulp
  import pytest
  from pytest import raises
  from scipy._lib._testutils import check_free_memory
  from scipy._lib._util import check_random_state
  from scipy.sparse import csr_matrix, coo_matrix, csr_array, coo_array, sparray, spmatrix, _construct
  from scipy.sparse._construct import rand
label_desc: Use image node_id 11 for calling the TestConstructUtils obj's underlying member method code with example usage: obj.test_eye(eye) without return types