docstr: Runs a noop elimination test case.
  
  Args:
    init_dataset_fn: Function to create the initial dataset
    transformation: Transformation to apply
    expected_name: Name of the transformation if it is not eliminated
docstr_tok: ["Runs","a","noop","elimination","test","case",".","Args",":","init_dataset_fn",":","Function","to","create","the","initial","dataset","transformation",":","Transformation","to","apply","expected_name",":","Name","of","the","transformation","if","it","is","not","eliminated"]
code: def testNoopElimination(
      self, init_dataset_fn, transformation, expected_name
  ):
      """Runs a noop elimination test case.
  
      Args:
        init_dataset_fn: Function to create the initial dataset
        transformation: Transformation to apply
        expected_name: Name of the transformation if it is not eliminated
      """
      dataset = init_dataset_fn()
  
      if expected_name:
          dataset = dataset.apply(
              testing.assert_next([expected_name, "FiniteTake"])
          )
      else:
          dataset = dataset.apply(testing.assert_next(["FiniteTake"]))
  
      dataset = dataset.apply(transformation)
      dataset = dataset.take(1)
      options = options_lib.Options()
      options.experimental_optimization.apply_default_optimizations = (
          False
      )
      options.experimental_optimization.noop_elimination = True
      dataset = dataset.with_options(options)
  
      # Run the first iteration for the side effect of checking the assertion.
      get_next = self.getNext(dataset)
      self.evaluate(get_next())
  
file_path: tensorflow-upstream/tensorflow/python/data/experimental/kernel_tests/optimization/noop_elimination_test.py
imports: import functools
  from absl.testing import parameterized
  from tensorflow.python.data.experimental.ops import testing
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import logging_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the NoopEliminationTest obj's underlying member method code with example usage: obj.testNoopElimination(init_dataset_fn, transformation, expected_name) without return types