code: def testIRecvAndSend(self):
      comm = self.COMM
      size = comm.Get_size()
      rank = comm.Get_rank()
      for smess in messages:
          req = comm.irecv(0, MPI.PROC_NULL)
          self.assertTrue(req)
          comm.send(smess, MPI.PROC_NULL)
          rmess = req.wait()
          self.assertFalse(req)
          self.assertIsNone(rmess)
      for smess in messages:
          buf = allocate(512)
          req = comm.irecv(buf, rank, 0)
          self.assertTrue(req)
          flag, rmess = req.test()
          self.assertTrue(req)
          self.assertFalse(flag)
          self.assertIsNone(rmess)
          comm.send(smess, rank, 0)
          self.assertTrue(req)
          flag, rmess = req.test()
          while not flag:
              flag, rmess = req.test()
          self.assertTrue(flag)
          self.assertFalse(req)
          self.assertEqual(rmess, smess)
      tmp = allocate(1024)
      for buf in (None, 1024, tmp):
          for smess in messages + [messages]:
              dst = (rank + 1) % size
              src = (rank - 1) % size
              req = comm.irecv(buf, src, 0)
              self.assertTrue(req)
              comm.send(smess, dst, 0)
              rmess = req.wait()
              self.assertFalse(req)
              self.assertEqual(rmess, smess)
      for smess in messages:
          src = dst = rank
          rreq1 = comm.irecv(None, src, 1)
          rreq2 = comm.irecv(None, src, 2)
          rreq3 = comm.irecv(None, src, 3)
          rreqs = [rreq1, rreq2, rreq3]
          for i in range(len(rreqs)):
              self.assertTrue(rreqs[i])
              comm.send(smess, dst, i + 1)
              index, obj = MPI.Request.waitany(rreqs)
              self.assertEqual(index, i)
              self.assertEqual(obj, smess)
              self.assertFalse(rreqs[index])
          index, obj = MPI.Request.waitany(rreqs)
          self.assertEqual(index, MPI.UNDEFINED)
          self.assertIsNone(obj)
      for smess in messages:
          src = dst = rank
          rreq1 = comm.irecv(None, src, 1)
          rreq2 = comm.irecv(None, src, 2)
          rreq3 = comm.irecv(None, src, 3)
          rreqs = [rreq1, rreq2, rreq3]
          index, flag, obj = MPI.Request.testany(rreqs)
          self.assertEqual(index, MPI.UNDEFINED)
          self.assertFalse(flag)
          self.assertIsNone(obj)
          for i in range(len(rreqs)):
              self.assertTrue(rreqs[i])
              comm.send(smess, dst, i + 1)
              index, flag, obj = MPI.Request.testany(rreqs)
              while not flag:
                  index, flag, obj = MPI.Request.testany(rreqs)
              self.assertEqual(index, i)
              self.assertTrue(flag)
              self.assertEqual(obj, smess)
              self.assertFalse(rreqs[i])
          index, flag, obj = MPI.Request.testany(rreqs)
          self.assertEqual(index, MPI.UNDEFINED)
          self.assertTrue(flag)
          self.assertIsNone(obj)
  
imports: from mpi4py import MPI
  import mpiunittest
  import threading
  import warnings
  import sys
label_desc: Use image node_id 3 for calling the BaseTestP2PObj obj's underlying member method code with example usage: obj.testIRecvAndSend() without return types