code: def test_bmat(self):
      A = coo_matrix([[1, 2], [3, 4]])
      B = coo_matrix([[5], [6]])
      C = coo_matrix([[7]])
      D = coo_matrix((0, 0))
  
      expected = matrix([[1, 2, 5], [3, 4, 6], [0, 0, 7]])
      assert_equal(
          construct.bmat([[A, B], [None, C]]).todense(), expected
      )
  
      expected = matrix([[1, 2, 0], [3, 4, 0], [0, 0, 7]])
      assert_equal(
          construct.bmat([[A, None], [None, C]]).todense(), expected
      )
  
      expected = matrix([[0, 5], [0, 6], [7, 0]])
      assert_equal(
          construct.bmat([[None, B], [C, None]]).todense(), expected
      )
  
      expected = matrix(np.empty((0, 0)))
      assert_equal(construct.bmat([[None, None]]).todense(), expected)
      assert_equal(
          construct.bmat([[None, D], [D, None]]).todense(), expected
      )
  
      # test bug reported in gh-5976
      expected = matrix([[7]])
      assert_equal(
          construct.bmat([[None, D], [C, None]]).todense(), expected
      )
  
      # test failure cases
      with assert_raises(ValueError) as excinfo:
          construct.bmat([[A], [B]])
      excinfo.match(r"Got blocks\[1,0\]\.shape\[1\] == 1, expected 2")
  
      with assert_raises(ValueError) as excinfo:
          construct.bmat([[A, C]])
      excinfo.match(r"Got blocks\[0,1\]\.shape\[0\] == 1, expected 2")
  
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, construct
  from scipy.sparse.construct import rand
  from scipy.sparse.sputils import matrix
label_desc: Use image node_id 18 for calling the TestConstructUtils obj's underlying member method code with example usage: obj.test_bmat() without return types