def testserializemessagesetwireformatunknownextension(self):
    # create a message using the message set wire format with an unknown
    # message.
    raw = unittest_mset_pb2.rawmessageset()

    # add an unknown extension.
    item = raw.item.add()
    item.type_id = 1545009
    message1 = unittest_mset_pb2.testmessagesetextension1()
    message1.i = 12345
    item.message = message1.serializetostring()

    serialized = raw.serializetostring()

    # parse message using the message set wire format.
    proto = unittest_mset_pb2.testmessageset()
    proto.mergefromstring(serialized)

    # verify that the unknown extension is serialized unchanged
    reserialized = proto.serializetostring()
    new_raw = unittest_mset_pb2.rawmessageset()
    new_raw.mergefromstring(reserialized)
    self.assertequal(raw, new_raw)
 def testoptions(self):
   proto = unittest_mset_pb2.testmessageset()
   self.asserttrue(proto.descriptor.getoptions().message_set_wire_format)