code: def test_repartition_consistent(ray_start_regular_shared):
      # repartition should be deterministic
      it1 = from_range(9, num_shards=1).repartition(2)
      it2 = from_range(9, num_shards=1).repartition(2)
      # union should work after repartition
      it3 = it1.union(it2)
      assert it1.num_shards() == 2
      assert it2.num_shards() == 2
      assert set(it1.get_shard(0)) == set(it2.get_shard(0))
      assert set(it1.get_shard(1)) == set(it2.get_shard(1))
  
      assert it3.num_shards() == 4
      assert set(it3.gather_async()) == set(it1.gather_async()) | set(
          it2.gather_async()
      )
  
imports: import sys
  import time
  import collections
  from collections import Counter
  import pytest
  import ray
  from ray.util.iter import from_items, from_iterators, from_range, from_actors, ParallelIteratorWorker, LocalIterator
  from ray._private.test_utils import Semaphore
label_desc: Use image node_id 22 for calling a global function with example usage: test_repartition_consistent(ray_start_regular_shared) without return types