From b9cb1842d01ebbbe2911bf297eb70fc6e248f753 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 11 Dec 2024 13:13:52 -0800 Subject: [PATCH] Delete old conformance test hack This is no longer relevant, and all 3 python implementations are conformant in JSON and binary formats PiperOrigin-RevId: 705214440 --- conformance/conformance_python.py | 58 ++----------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) diff --git a/conformance/conformance_python.py b/conformance/conformance_python.py index 77076bd885bf..29df365c3138 100755 --- a/conformance/conformance_python.py +++ b/conformance/conformance_python.py @@ -48,64 +48,10 @@ def _create_test_message(type): def do_test(request): response = conformance_pb2.ConformanceResponse() - if request.message_type == "conformance.FailureSet": - failure_set = conformance_pb2.FailureSet() - failures = [] - # TODO: Remove, this is a hack to detect if the old vs new - # parser is used by the cpp code. Relying on a bug in the old parser. - hack_proto = test_messages_proto2_pb2.TestAllTypesProto2() - old_parser = True - try: - hack_proto.ParseFromString(b"\322\002\001") - except message.DecodeError as e: - old_parser = False - if old_parser: - # the string above is one of the failing conformance test strings of the - # old parser. If we succeed the c++ implementation is using the old - # parser so we add the list of failing conformance tests. - failures = [ - "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64", - "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64", - ] - for x in failures: - failure_set.test.append(conformance_pb2.TestStatus(name=x)) - response.protobuf_payload = failure_set.SerializeToString() - return response - - isJson = request.WhichOneof("payload") == "json_payload" + is_json = request.WhichOneof("payload") == "json_payload" test_message = _create_test_message(request.message_type) - if (not isJson) and (test_message is None): + if (not is_json) and (test_message is None): raise ProtocolError("Protobuf request doesn't have specific payload type") try: