class_docstr: Tests for `tf.data.experimental.assert_cardinality()`.
class_docstr_tok: ["Tests","for","`","tf.data.experimental.assert_cardinality","(",")","`","."]
code: def testCorrectCardinality(self):
      dataset = dataset_ops.Dataset.range(10).filter(lambda x: True)
      self.assertEqual(
          self.evaluate(cardinality.cardinality(dataset)),
          cardinality.UNKNOWN,
      )
      self.assertDatasetProduces(dataset, expected_output=range(10))
      dataset = dataset.apply(cardinality.assert_cardinality(10))
      self.assertEqual(
          self.evaluate(cardinality.cardinality(dataset)), 10
      )
      self.assertDatasetProduces(dataset, expected_output=range(10))
  
file_path: tensorflow-upstream/tensorflow/python/data/experimental/kernel_tests/assert_cardinality_test.py
imports: from absl.testing import parameterized
  from tensorflow.python.data.experimental.ops import cardinality
  from tensorflow.python.data.kernel_tests import checkpoint_test_base
  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 errors
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the AssertCardinalityTest obj's underlying member method code with example usage: obj.testCorrectCardinality() without return types