code: def test_inter_rank_and_size(self):
      ranks_and_sizes = self.mpi_comm.gather(
          (self.communicator.inter_rank, self.communicator.inter_size)
      )
  
      if self.mpi_comm.rank == 0:
          for inter_rank, inter_size in ranks_and_sizes:
              self.assertTrue(0 <= inter_rank < inter_size)
  
          sizes = list(set(x[1] for x in ranks_and_sizes))
          self.assertEqual(len(sizes), 1)
          size = sizes[0]
  
          ranks = list(sorted(set(x[0] for x in ranks_and_sizes)))
          self.assertEqual(ranks, list(range(size)))
  
file_path: chainer/tests/chainermn_tests/communicator_tests/test_node_aware_communicator_base.py
imports: import collections
  import os
  import unittest
  import mpi4py.MPI
  import pytest
  from chainermn.communicators.mpi_communicator_base import MpiCommunicatorBase
label_desc: Use image node_id 4 for calling the TestMpiCommunicatorBase obj's underlying member method code with example usage: obj.test_inter_rank_and_size() without return types