def test_receive_serializable(self): m = msg.DummySerdeMessage("test_field") self.cout.send(m) msgs = self.cin.receive() payload = msgs[0] m2 = msg.DummySerdeMessage.deserialize(payload) m2 = m2[0] self.assertIsInstance(m2, msg.DummySerdeMessage) self.assertEqual(m2.field, m.field)
def test_receive_serialized_object(self): pool = ThreadPoolExecutor(max_workers=1) m = msg.DummySerdeMessage("field") result = pool.submit(self.sink.receive) # Yield GIL time.sleep(0.001) self.vent.send(m) payload = result.result() payload = payload[0] objs = msg.DummySerdeMessage.deserialize(payload) self.assertEqual(len(objs), 1) o = objs[0] self.assertEqual(o.field, m.field)
def test_receive_serialized_object(self): pool = ThreadPoolExecutor(max_workers=1) m = msg.DummySerdeMessage("field") self.subscriber.subscribe("test_topic") result = pool.submit(self.subscriber.receive) # Yield GIL time.sleep(0.001) self.emitter.publish("test_topic", m) channel, payload = result.result() objs = msg.DummySerdeMessage.deserialize(payload) self.assertEqual(len(objs), 1) o = objs[0] self.assertEqual(o.field, m.field)
def test_arg_serializable_types(self): m = msg.DummySerdeMessage("somefield") self.cout.send(m)
def test_publish_serializable(self): m = msg.DummySerdeMessage("field") self.emitter.publish("test_topic", m)
def test_send_serializable(self): m = msg.DummySerdeMessage("field") self.emitter.send(m)