def _dequeue_message_from_stream(self, f): """Returns next deserialized message in queue or None.""" assert self.packer, 'Cannot unpack stream data without packer.' obj = self.packer.load(f) datatypename = obj[MESSAGE_KEY] message = deserialize_from_builtins(obj, Message.class_by_name(datatypename)) return message
def test_message_class_by_name(): assert Message.class_by_name("Shutdown") is Shutdown assert Message.class_by_name("CompletionResponse") is CompletionResponse
def test_message_class_by_name(): assert Message.class_by_name('Shutdown') is Shutdown assert Message.class_by_name('CompletionResponse') is CompletionResponse