code: def testAttrCopyException(self):
      cls, obj = type(self.obj), self.obj
      if not isinstance(obj, MPI.Datatype):
          return
      if not hasattr(cls, "Dup"):
          return
  
      def copy_fn(o, k, v):
          raise ValueError
  
      self.keyval = cls.Create_keyval(copy_fn, None)
      obj.Set_attr(self.keyval, "value")
      with self.assertRaises(MPI.Exception) as exc_cm:
          with unittest.capture_stderr() as stderr:
              obj.Dup().Free()
      ierr = exc_cm.exception.Get_error_code()
      self.assertEqual(ierr, MPI.ERR_OTHER)
      self.assertIn("ValueError", stderr.getvalue())
  
imports: from mpi4py import MPI
  import mpiunittest
label_desc: Use image node_id 9 for calling the BaseTestAttr obj's underlying member method code with example usage: obj.testAttrCopyException() without return types