code: def test_multiple_cursors(self):
      # pylint: disable=protected-access
      lazy_instances1 = _LazyInstances(
          lambda: (i for i in self.instances)
      )
      lazy_instances2 = _LazyInstances(
          lambda: (i for i in self.instances)
      )
  
      eager_instances1 = self.instances[:]
      eager_instances2 = self.instances[:]
  
      for instances1, instances2 in [
          (eager_instances1, eager_instances2),
          (lazy_instances1, lazy_instances2),
      ]:
          iterator = BasicIterator(batch_size=1, instances_per_epoch=2)
          iterator.index_with(self.vocab)
  
          # First epoch through dataset1
          batches = list(
              iterator._create_batches(instances1, shuffle=False)
          )
          grouped_instances = [batch.instances for batch in batches]
          assert grouped_instances == [
              [self.instances[0]],
              [self.instances[1]],
          ]
  
          # First epoch through dataset2
          batches = list(
              iterator._create_batches(instances2, shuffle=False)
          )
          grouped_instances = [batch.instances for batch in batches]
          assert grouped_instances == [
              [self.instances[0]],
              [self.instances[1]],
          ]
  
          # Second epoch through dataset1
          batches = list(
              iterator._create_batches(instances1, shuffle=False)
          )
          grouped_instances = [batch.instances for batch in batches]
          assert grouped_instances == [
              [self.instances[2]],
              [self.instances[3]],
          ]
  
          # Second epoch through dataset2
          batches = list(
              iterator._create_batches(instances2, shuffle=False)
          )
          grouped_instances = [batch.instances for batch in batches]
          assert grouped_instances == [
              [self.instances[2]],
              [self.instances[3]],
          ]
  
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 9 for calling the TestBasicIterator obj's underlying member method code with example usage: obj.test_multiple_cursors() without return types