code: def testCreate(self):
      for comm in [MPI.COMM_SELF, MPI.COMM_WORLD]:
          for commute in [True, False]:
              for N in range(4):
                  myop = MPI.Op.Create(mysum, commute)
                  self.assertFalse(myop.is_predefined)
                  try:
                      size = comm.Get_size()
                      rank = comm.Get_rank()
                      a = array.array(
                          "i", [i * (rank + 1) for i in range(N)]
                      )
                      b = array.array("i", [0] * len(a))
                      comm.Allreduce([a, MPI.INT], [b, MPI.INT], myop)
                      scale = sum(range(1, size + 1))
                      for i in range(N):
                          self.assertEqual(b[i], scale * i)
                      res = myop(a, b)
                      self.assertIs(res, b)
                      for i in range(N):
                          self.assertEqual(b[i], a[i] + scale * i)
                      myop2 = MPI.Op(myop)
                      a = array.array("i", [1] * N)
                      b = array.array("i", [2] * N)
                      res = myop2(a, b)
                      self.assertIs(res, b)
                      for i in range(N):
                          self.assertEqual(b[i], 3)
                      myop2 = None
                  finally:
                      myop.Free()
  
imports: from mpi4py import MPI
  import mpiunittest
label_desc: Use image node_id 2 for calling the TestOp obj's underlying member method code with example usage: obj.testCreate() without return types