class_docstr: Tests text data class.
      
docstr: Tests bucketing.
          
docstr_tok: ["Tests","bucketing","."]
code: def test_bucketing(self):
      """Tests bucketing."""
      hparams = copy.copy(self._hparams)
      hparams.update(
          {"bucket_boundaries": [7], "bucket_batch_sizes": [6, 4]}
      )
  
      text_data = tx.data.MonoTextData(hparams)
      iterator = text_data.dataset.make_initializable_iterator()
      text_data_batch = iterator.get_next()
  
      hparams.update(
          {
              "bucket_boundaries": [7],
              "bucket_batch_sizes": [7, 7],
              "allow_smaller_final_batch": False,
          }
      )
  
      text_data_1 = tx.data.MonoTextData(hparams)
      iterator_1 = text_data_1.dataset.make_initializable_iterator()
      text_data_batch_1 = iterator_1.get_next()
  
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
          sess.run(tf.local_variables_initializer())
          sess.run(tf.tables_initializer())
          sess.run(iterator.initializer)
          sess.run(iterator_1.initializer)
  
          while True:
              try:
                  # Run the logics
                  data_batch_, data_batch_1_ = sess.run(
                      [text_data_batch, text_data_batch_1]
                  )
  
                  length_ = data_batch_["length"][0]
                  if length_ < 7:
                      last_batch_size = hparams["num_epochs"] % 6
                      self.assertTrue(
                          len(data_batch_["text"]) == 6
                          or len(data_batch_["text"]) == last_batch_size
                      )
                  else:
                      last_batch_size = hparams["num_epochs"] % 4
                      self.assertTrue(
                          len(data_batch_["text"]) == 4
                          or len(data_batch_["text"]) == last_batch_size
                      )
  
                  self.assertEqual(len(data_batch_1_["text"]), 7)
  
              except tf.errors.OutOfRangeError:
                  print("Done -- epoch limit reached")
                  break
  
imports: import tempfile
  import copy
  import numpy
  import tensorflow
  import texar.tf
label_desc: Use image node_id 5 for calling the MonoTextDataTest obj's underlying member method code with example usage: obj.test_bucketing() without return types