code: def test_scatter_index(combination):
      length, size = combination
      it = chainermn.datasets.scatter._scatter_index(
          length, size, False
      )
      union = set()
      total = []
      subsets = []
      for _, b, e in it:
          subset = list(range(b, e))
          subsets.append(subset)
          total.extend(subset)
          for x in subset:
              union.add(x)
      assert length == len(total)  # no duplication
      assert length == len(union)  # no duplication & no lacking
      for lhs, rhs in itertools.combinations(subsets, 2):
          set(lhs).isdisjoint(set(rhs))
          assert abs(len(lhs) - len(rhs)) <= 1
  
imports: from __future__ import with_statement
  import itertools
  import unittest
  import mpi4py.MPI
  import numpy
  import pytest
  from chainer import testing
  import chainermn
  from chainermn.communicators.flat_communicator import FlatCommunicator
  from chainermn.communicators.naive_communicator import NaiveCommunicator
  import chainerx
label_desc: Use image node_id 5 for calling a global function with example usage: test_scatter_index(combination) without return types