Add python test for deprecated syntax

PiperOrigin-RevId: 563175424
pull/13815/head
Jie Luo 2 years ago committed by Copybara-Service
parent ad5ba75bf9
commit 8a11c3c8f0
  1. 1
      python/google/protobuf/internal/descriptor_test.py
  2. 13
      upb/python/descriptor.c

@ -553,6 +553,7 @@ class DescriptorTest(unittest.TestCase):
self.assertEqual(self.my_file.package, 'protobuf_unittest')
self.assertEqual(self.my_file.pool, self.pool)
self.assertFalse(self.my_file.has_options)
self.assertEqual(self.my_file.syntax, 'proto2')
file_proto = descriptor_pb2.FileDescriptorProto()
self.my_file.CopyToProto(file_proto)
self.assertEqual(self.my_file.serialized_pb,

@ -639,7 +639,13 @@ static PyGetSetDef PyUpb_Descriptor_Getters[] = {
"Containing type"},
{"is_extendable", PyUpb_Descriptor_GetIsExtendable, NULL},
{"has_options", PyUpb_Descriptor_GetHasOptions, NULL, "Has Options"},
// begin:github_only
{"syntax", &PyUpb_Descriptor_GetSyntax, NULL, "Syntax"},
// end:github_only
// begin:google_only
// // TODO(b/271287872) Use this to open-source syntax deprecation.
// {"deprecated_syntax", &PyUpb_Descriptor_GetSyntax, NULL, "Syntax"},
// end:google_only
{NULL}};
static PyMethodDef PyUpb_Descriptor_Methods[] = {
@ -1328,7 +1334,14 @@ static PyGetSetDef PyUpb_FileDescriptor_Getters[] = {
{"public_dependencies", PyUpb_FileDescriptor_GetPublicDependencies, NULL,
"Dependencies"},
{"has_options", PyUpb_FileDescriptor_GetHasOptions, NULL, "Has Options"},
// begin:github_only
{"syntax", PyUpb_FileDescriptor_GetSyntax, (setter)NULL, "Syntax"},
// end:github_only
// begin:google_only
// // TODO(b/271287872) Use this to open-source syntax deprecation.
// {"deprecated_syntax", PyUpb_FileDescriptor_GetSyntax, (setter)NULL,
// "Syntax"},
// end:google_only
{NULL},
};

Loading…
Cancel
Save