code: def test_shuffle(self):
      # pylint: disable=protected-access
      for test_instances in (self.instances, self.lazy_instances):
          iterator = BasicIterator(
              batch_size=2, instances_per_epoch=100
          )
  
          in_order_batches = list(
              iterator._create_batches(test_instances, shuffle=False)
          )
          shuffled_batches = list(
              iterator._create_batches(test_instances, shuffle=True)
          )
  
          assert len(in_order_batches) == len(shuffled_batches)
  
          # With 100 instances, shuffling better change the order.
          assert in_order_batches != shuffled_batches
  
          # But not the counts of the instances.
          in_order_counts = Counter(
              instance
              for batch in in_order_batches
              for instance in batch
          )
          shuffled_counts = Counter(
              instance
              for batch in shuffled_batches
              for instance in batch
          )
          assert in_order_counts == shuffled_counts
  
imports: from __future__ import absolute_import
  from collections import Counter
  from allennlp.common import Params
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data import Instance, Token, Vocabulary
  from allennlp.data.dataset_readers.dataset_reader import _LazyInstances
  from allennlp.data.fields import TextField
  from allennlp.data.iterators import BasicIterator
  from allennlp.data.token_indexers import SingleIdTokenIndexer
label_desc: Use image node_id 7 for calling the TestBasicIterator obj's underlying member method code with example usage: obj.test_shuffle() without return types