code: def test_nan_inf(valid_df):
      # Capping infs
      capper = ColumnCapper(discard_infs=False)
      assert (capper.fit_transform(valid_df) == np.inf).sum().sum() == 0
      assert np.isnan(capper.fit_transform(valid_df)).sum() == 1
  
      # Discarding infs
      capper = ColumnCapper(discard_infs=True)
      assert (capper.fit_transform(valid_df) == np.inf).sum().sum() == 0
      assert np.isnan(capper.fit_transform(valid_df)).sum() == 2
  
file_path: scikit-lego/tests/test_preprocessing/test_columncapper.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.utils.validation import FLOAT_DTYPES
  from sklego.common import flatten
  from sklego.preprocessing import ColumnCapper
  from tests.conftest import general_checks, nonmeta_checks, select_tests, transformer_checks
label_desc: Use image node_id 6 for calling a global function with example usage: test_nan_inf(valid_df) without return types