class_docstr: Tests functions for representative datasets.
class_docstr_tok: ["Tests","functions","for","representative","datasets","."]
code: def test_get_num_samples_returns_none_when_len_raises_error(self):
      class LenRaisingError:
          """A test-only class that raises an error when len() is called.
  
          This mocks the behavior of an Iterator whose size cannot be determined.
          One example is `tf.data.Dataset` whose samples are generated by a
          Generator.
          """
  
          def __len__(self):
              raise ValueError(
                  "You cannot take the len() of instance of LenRaisingError."
              )
  
      self.assertIsNone(repr_dataset.get_num_samples(LenRaisingError()))
  
imports: import random
  import numpy
  from tensorflow.compiler.mlir.quantization.tensorflow.python import representative_dataset
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import test
  from tensorflow.python.types import core
label_desc: Use image node_id 11 for calling the RepresentativeDatasetTest obj's underlying member method code with example usage: obj.test_get_num_samples_returns_none_when_len_raises_error() without return types