code: def testExhaustion(self):
      init_dist = [0.5, 0.5]
      target_dist = [0.9, 0.1]
      dataset = dataset_ops.Dataset.range(10000)
      dataset = dataset.rejection_resample(
          class_func=lambda x: x % 2,
          target_dist=target_dist,
          initial_dist=init_dist,
      )
  
      get_next = self.getNext(dataset, requires_initialization=True)
      returned = []
      with self.assertRaises(errors.OutOfRangeError):
          while True:
              returned.append(self.evaluate(get_next()))
  
      classes, _ = zip(*returned)
      bincount = np.bincount(
          np.array(classes), minlength=len(init_dist)
      ).astype(np.float32) / len(classes)
  
      self.assertAllClose(target_dist, bincount, atol=1e-2)
  
file_path: tensorflow-upstream/tensorflow/python/data/kernel_tests/rejection_resample_test.py
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import string_ops
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 4 for calling the RejectionResampleTest obj's underlying member method code with example usage: obj.testExhaustion() without return types