code: def test_nmf_custom_init_shape_error():
      # Check that an informative error is raised when custom initialization does not
      # have the right shape
      rng = np.random.RandomState(0)
      X = rng.random_sample((6, 5))
      H = rng.random_sample((2, 5))
      nmf = NMF(n_components=2, init="custom", random_state=0)
  
      with pytest.raises(
          ValueError, match="Array with wrong first dimension passed"
      ):
          nmf.fit(X, H=H, W=rng.random_sample((5, 2)))
  
      with pytest.raises(
          ValueError, match="Array with wrong second dimension passed"
      ):
          nmf.fit(X, H=H, W=rng.random_sample((6, 3)))
  
imports: import re
  import sys
  import warnings
  from io import StringIO
  import numpy
  import pytest
  from scipy import linalg
  from sklearn.base import clone
  from sklearn.decomposition import NMF, MiniBatchNMF, non_negative_factorization
  from sklearn.decomposition import _nmf
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils._testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, ignore_warnings
  from sklearn.utils.extmath import squared_norm
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS
label_desc: Use image node_id 41 for calling a global function with example usage: test_nmf_custom_init_shape_error() without return types