code: def test_repartition_less(ray_start_regular_shared):
      it = from_range(9, num_shards=3)
      # chaining operations after a repartition should work
      it1 = it.repartition(2).for_each(lambda x: 2 * x)
      assert repr(it1) == (
          "ParallelIterator[from_range[9, "
          + "shards=3].repartition[num_partitions=2].for_each()]"
      )
  
      assert it1.num_shards() == 2
      shard_0_set = set(it1.get_shard(0))
      shard_1_set = set(it1.get_shard(1))
      assert shard_0_set == {0, 4, 6, 10, 12, 16}
      assert shard_1_set == {2, 8, 14}
  
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 20 for calling a global function with example usage: test_repartition_less(ray_start_regular_shared) without return types