aboutsummaryrefslogtreecommitdiff
path: root/conformance/conformance_python.py
diff options
context:
space:
mode:
authorYilun Chong <yilunchong@google.com>2017-06-30 17:22:32 -0700
committerYilun Chong <yilunchong@google.com>2017-06-30 17:22:32 -0700
commit3adb054bbfa83530ca5a5fd54a856755fd72af83 (patch)
tree4d09a00969cdc7833dca181d6910b79f5ac877ae /conformance/conformance_python.py
parenta7d5be6a910caabc4b26d73bc5c369dbc638c4c3 (diff)
downloadprotobuf-3adb054bbfa83530ca5a5fd54a856755fd72af83.tar.gz
protobuf-3adb054bbfa83530ca5a5fd54a856755fd72af83.tar.bz2
protobuf-3adb054bbfa83530ca5a5fd54a856755fd72af83.zip
add some test proto2 supported, add js proto2 supported, fixed some error
Diffstat (limited to 'conformance/conformance_python.py')
-rwxr-xr-xconformance/conformance_python.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/conformance/conformance_python.py b/conformance/conformance_python.py
index 62cfce87..c5ba2467 100755
--- a/conformance/conformance_python.py
+++ b/conformance/conformance_python.py
@@ -38,6 +38,8 @@ See conformance.proto for more information.
import struct
import sys
import os
+from google.protobuf import descriptor
+from google.protobuf import descriptor_pool
from google.protobuf import json_format
from google.protobuf import message
from google.protobuf import test_messages_proto3_pb2
@@ -54,15 +56,16 @@ class ProtocolError(Exception):
pass
def do_test(request):
- isProto3 = (request.message_type == "protobuf_test_messages.proto3.TestAllTypes")
+ isProto3 = (request.message_type == "protobuf_test_messages.proto3.TestAllTypesProto3")
isJson = (request.WhichOneof('payload') == 'json_payload')
isProto2 = (request.message_type == "protobuf_test_messages.proto2.TestAllTypesProto2")
if (not isProto3) and (not isJson) and (not isProto2):
raise ProtocolError("Protobuf request doesn't have specific payload type")
-
+
test_message = test_messages_proto2_pb2.TestAllTypesProto2() if isProto2 else \
- test_messages_proto3_pb2.TestAllTypes()
+ test_messages_proto3_pb2.TestAllTypesProto3()
+
response = conformance_pb2.ConformanceResponse()
try: