Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 532155491
  • Loading branch information
anandolee authored and Copybara-Service committed May 15, 2023
1 parent fc7454a commit 3b8a472
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 3 additions & 16 deletions python/google/protobuf/internal/descriptor_pool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,9 @@ def testMessage(self):

def _TestEnum(self, prefix):
pool = descriptor_pool.DescriptorPool()
if api_implementation.Type() == 'cpp':
pool.AddEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR)
else:
pool._AddEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR)
pool.AddSerializedFile(unittest_import_public_pb2.DESCRIPTOR.serialized_pb)
pool.AddSerializedFile(unittest_import_pb2.DESCRIPTOR.serialized_pb)
pool.AddSerializedFile(unittest_pb2.DESCRIPTOR.serialized_pb)
self.assertEqual(
'protobuf_unittest.ForeignEnum',
pool.FindEnumTypeByName(
Expand All @@ -939,10 +938,6 @@ def _TestEnum(self, prefix):
pool.FindEnumTypeByName(
prefix + 'protobuf_unittest.ForeignEnum.NestedEnum')

if api_implementation.Type() == 'cpp':
pool.AddEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR)
else:
pool._AddEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR)
self.assertEqual(
'protobuf_unittest.TestAllTypes.NestedEnum',
pool.FindEnumTypeByName(
Expand Down Expand Up @@ -1057,14 +1052,6 @@ def testAddTypeError(self):
if api_implementation.Type() != 'python':
with self.assertRaises(TypeError):
pool.AddDescriptor(0)
with self.assertRaises(TypeError):
pool.AddEnumDescriptor(0)
with self.assertRaises(TypeError):
pool.AddServiceDescriptor(0)
with self.assertRaises(TypeError):
pool.AddExtensionDescriptor(0)
with self.assertRaises(TypeError):
pool.AddFileDescriptor(0)
else:
with self.assertRaises(TypeError):
pool._AddDescriptor(0)
Expand Down
2 changes: 0 additions & 2 deletions python/google/protobuf/pyext/descriptor_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,6 @@ static PyMethodDef Methods[] = {
{"AddSerializedFile", AddSerializedFile, METH_O,
"Adds a serialized FileDescriptorProto to this pool."},

// TODO(amauryfa): Understand why the Python implementation differs from
// this one, ask users to use another API and deprecate these functions.
{"AddFileDescriptor", AddFileDescriptor, METH_O,
"No-op. Add() must have been called before."},
{"AddDescriptor", AddDescriptor, METH_O,
Expand Down

0 comments on commit 3b8a472

Please sign in to comment.