def test_with_data(self): """Translate to and from json_object""" j = Jobj(json_str) self.assertEqual( j.as_str(), json_str )
def from_event(cls, flux_handle, json_str): if isinstance(flux_handle, core.Flux): flux_handle = flux_handle.handle j = Jobj(json_str) return cls( flux_handle, handle=lib.flux_mrpc_create_fromevent( flux_handle, j.get(), ), )
def test_create_empty(self): """Create an empty json object""" j = Jobj() self.assertEqual(j.as_str(), '')
def outarg(self, json_str): j = Jobj(json_str) self.pimpl.put_outarg(j.get())
def outarg(self, nodeid): j = Jobj() err = self.pimpl.get_outarg(nodeid, j.get_as_dptr()) if err != 0 or j.get() == ffi.NULL: raise RuntimeError("MRPC error: {}".format(err)) return j.as_str()
def inarg(self, json_str): j = Jobj(json_str) self.pimpl.put_inarg(j.get())
def inarg(self): j = Jobj() err = self.pimpl.get_inarg(j.get_as_dptr()) if err != 0 or j.get() == ffi.NULL: raise RuntimeError("MRPC error: {}".format(err)) return j.as_str()