From 4715158c2f91a7ec656927f67d52b84db7bd5e65 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Mon, 7 Aug 2023 23:52:51 -0700 Subject: [PATCH] Protobuf usage clean up PiperOrigin-RevId: 554714188 --- pybind11_protobuf/tests/extension_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pybind11_protobuf/tests/extension_test.py b/pybind11_protobuf/tests/extension_test.py index 8499899..0340882 100644 --- a/pybind11_protobuf/tests/extension_test.py +++ b/pybind11_protobuf/tests/extension_test.py @@ -11,6 +11,7 @@ from absl.testing import absltest from absl.testing import parameterized +from google.protobuf import unknown_fields from google.protobuf.internal import api_implementation from pybind11_protobuf.tests import extension_in_other_file_in_deps_pb2 from pybind11_protobuf.tests import extension_in_other_file_pb2 @@ -179,8 +180,8 @@ def test_reserialize_allow_unknown_inner(self): a = get_allow_unknown_inner(96) b = m.reserialize_allow_unknown_inner(a) if api_implementation.Type() == 'cpp': - self.assertLen(b.UnknownFields(), 1) - self.assertEqual(2001, b.UnknownFields()[0].field_number) + self.assertLen(unknown_fields.UnknownFieldSet(b), 1) + self.assertEqual(2001, unknown_fields.UnknownFieldSet(b)[0].field_number) else: b_value = b.Extensions[ extension_in_other_file_pb2.AllowUnknownInnerExtension.hook].value @@ -190,8 +191,9 @@ def test_reserialize_allow_unknown_outer(self): a = extension_pb2.AllowUnknownOuter(inner=get_allow_unknown_inner(97)) b = m.reserialize_allow_unknown_outer(a) if api_implementation.Type() == 'cpp': - self.assertLen(b.inner.UnknownFields(), 1) - self.assertEqual(2001, b.inner.UnknownFields()[0].field_number) + self.assertLen(unknown_fields.UnknownFieldSet(b.inner), 1) + self.assertEqual( + 2001, unknown_fields.UnknownFieldSet(b.inner)[0].field_number) else: b_inner_value = b.inner.Extensions[ extension_in_other_file_pb2.AllowUnknownInnerExtension.hook].value