Fixed broken test by implementing FieldDescriptor.has_presence.

PiperOrigin-RevId: 447124542
pull/13171/head
Joshua Haberman 3 years ago committed by Copybara-Service
parent 0e8772fc20
commit b034f5d196
  1. 8
      python/descriptor.c
  2. 1
      python/pb_unit_tests/message_test_wrapper.py

@ -1011,6 +1011,12 @@ static PyObject* PyUpb_FieldDescriptor_GetHasOptions(
return PyBool_FromLong(upb_FieldDef_HasOptions(self->def));
}
static PyObject* PyUpb_FieldDescriptor_GetHasPresence(
PyUpb_DescriptorBase* _self, void* closure) {
PyUpb_DescriptorBase* self = (void*)_self;
return PyBool_FromLong(upb_FieldDef_HasPresence(self->def));
}
static PyObject* PyUpb_FieldDescriptor_GetOptions(PyObject* _self,
PyObject* args) {
PyUpb_DescriptorBase* self = (void*)_self;
@ -1049,6 +1055,8 @@ static PyGetSetDef PyUpb_FieldDescriptor_Getters[] = {
"Containing oneof"},
{"has_options", (getter)PyUpb_FieldDescriptor_GetHasOptions, NULL,
"Has Options"},
{"has_presence", (getter)PyUpb_FieldDescriptor_GetHasPresence, NULL,
"Has Presence"},
// TODO(https://github.com/protocolbuffers/upb/issues/459)
//{ "_options",
//(getter)NULL, (setter)SetOptions, "Options"}, { "_serialized_options",

@ -51,7 +51,6 @@ MessageTest.testPickleRepeatedScalarContainer_proto3.__unittest_expecting_failur
Proto2Test.testPythonicInit.__unittest_expecting_failure__ = True
Proto2Test.test_documentation.__unittest_expecting_failure__ = True
Proto3Test.testModifyMapEntryWhileIterating.__unittest_expecting_failure__ = True
Proto3Test.testProto3Optional.__unittest_expecting_failure__ = True
if __name__ == '__main__':
unittest.main(verbosity=2)

Loading…
Cancel
Save