code: def test_nlevel_categories(nlevels, shape):
      """ideally the returned matrix should have nlevel+1 different categories,
      +1 because the Corrupt class introduce np.nan however, if the missing value
      introduced by Corrupt class happens to replace a group of categories, the
      unique category number would be < nlevel + 1
      """
      dataframe = randc(nlevels, shape)
      assert len(np.unique(dataframe)) <= nlevels + 1
  
imports: import numpy
  import pytest
  from impyute.dataset.base import randc
  from impyute.ops import error
label_desc: Use image node_id 2 for calling a global function with example usage: test_nlevel_categories(nlevels, shape) without return types