code: def test_shuffle(tmp_path):
      args = tagger.parse_args(
          args=[
              "--batch_size",
              "10",
              "--shorthand",
              "en_test",
              "--augment_nopunct",
              "0.0",
          ]
      )
  
      # 100 looked nice but was actually a 1/1000000 chance of the test failing
      # so let's crank it up to 1000 and make it 1/10^58
      no_xpos = [
          NO_XPOS_TEMPLATE.format(index=idx, indexp=idx + 1)
          for idx in range(1000)
      ]
      no_doc = CoNLL.conll2doc(input_str="\n\n".join(no_xpos))
      no_data = Dataset(no_doc, args, None)
  
      yes_xpos = [
          YES_XPOS_TEMPLATE.format(index=idx, indexp=idx + 101)
          for idx in range(1000)
      ]
      yes_doc = CoNLL.conll2doc(input_str="\n\n".join(yes_xpos))
      yes_data = Dataset(yes_doc, args, None)
  
      shuffled = ShuffledDataset([no_data, yes_data], 10)
  
      assert sum(1 for _ in shuffled) == 200
  
      num_with = 0
      num_without = 0
      for batch in shuffled:
          if batch.xpos is not None:
              num_with += 1
          else:
              num_without += 1
          # at the halfway point of the iteration, there should be at
          # least one in each category
          # for example, if we had forgotten to shuffle, this assertion would fail
          if num_with + num_without == 100:
              assert num_with > 1
              assert num_without > 1
  
      assert num_with == 100
      assert num_without == 100
  
file_path: stanza/stanza/tests/pos/test_data.py
imports: import os
  import pytest
  from stanza.models.common.doc import *
  from stanza.models import tagger
  from stanza.models.pos.data import Dataset, ShuffledDataset
  from stanza.utils.conll import CoNLL
  from stanza.tests.pos.test_tagger import TRAIN_DATA, TRAIN_DATA_NO_XPOS, TRAIN_DATA_NO_UPOS, TRAIN_DATA_NO_FEATS
label_desc: Use image node_id 8 for calling a global function with example usage: test_shuffle(tmp_path) without return types