code: def test_truncate_dataset_on_len(self):
      ds = _test_dataset_ints([5, 6, 7], [8, 9, 10])
      ds1 = tf_inputs.truncate_dataset_on_len(
          ds, True, len_map={"inputs": 6, "targets": 4}
      )
      expected_ds = _test_dataset_ints([5, 6, 6], [4, 4, 4])
  
      # training, should filter.
      assert_dataset(ds1, list(expected_ds.as_numpy_iterator()))
  
      # not Training, shouldn't filter.
      ds2 = tf_inputs.truncate_dataset_on_len(
          ds, False, len_map={"inputs": 6, "targets": 4}
      )
      assert_dataset(ds2, list(ds.as_numpy_iterator()))
  
      # not Training, but asked to filter, should filter.
      ds3 = tf_inputs.truncate_dataset_on_len(
          ds,
          False,
          len_map={"inputs": 6, "targets": 4},
          truncate_on_eval=True,
      )
      assert_dataset(ds3, list(expected_ds.as_numpy_iterator()))
  
imports: import collections
  import os
  from unittest import mock
  import gin
  import numpy
  from t5.data import assert_dataset
  from t5.data import preprocessors
  import tensorflow
  import tensorflow_datasets
  from trax.data import inputs
  from trax.data import tf_inputs
label_desc: Use image node_id 19 for calling the TFInputsTest obj's underlying member method code with example usage: obj.test_truncate_dataset_on_len() without return types