code: def test_imputation_adds_missing_indicator_if_add_indicator_is_true(
      imputer, missing_value_test
  ):
      """Check that missing indicator always exists when add_indicator=True.
  
      Non-regression test for gh-26590.
      """
      X_train = np.array([[0, np.nan], [1, 2]])
  
      # Test data where missing_value_test variable can be set to np.nan or 1.
      X_test = np.array([[0, missing_value_test], [1, 2]])
  
      imputer.set_params(add_indicator=True)
      imputer.fit(X_train)
  
      X_test_imputed_with_indicator = imputer.transform(X_test)
      assert X_test_imputed_with_indicator.shape == (2, 3)
  
      imputer.set_params(add_indicator=False)
      imputer.fit(X_train)
      X_test_imputed_without_indicator = imputer.transform(X_test)
      assert X_test_imputed_without_indicator.shape == (2, 2)
  
      assert_allclose(
          X_test_imputed_with_indicator[:, :-1],
          X_test_imputed_without_indicator,
      )
      if np.isnan(missing_value_test):
          expected_missing_indicator = [1, 0]
      else:
          expected_missing_indicator = [0, 0]
  
      assert_allclose(
          X_test_imputed_with_indicator[:, -1],
          expected_missing_indicator,
      )
  
file_path: scikit-learn/sklearn/impute/tests/test_common.py
imports: import numpy
  import pytest
  from sklearn.experimental import enable_iterative_imputer
  from sklearn.impute import IterativeImputer, KNNImputer, SimpleImputer
  from sklearn.utils._testing import assert_allclose, assert_allclose_dense_sparse, assert_array_equal
  from sklearn.utils.fixes import CSR_CONTAINERS
label_desc: Use image node_id 9 for calling a global function with example usage: test_imputation_adds_missing_indicator_if_add_indicator_is_true(imputer, missing_value_test) without return types