Raise AttributeError
on attempts to access unset oneof
fields (#510)
This commit is contained in:
committed by
GitHub
parent
098989e9e9
commit
6faac1d1ca
@@ -50,8 +50,10 @@ def test_bytes_are_the_same_for_oneof():
|
||||
|
||||
# None of these fields were explicitly set BUT they should not actually be null
|
||||
# themselves
|
||||
assert isinstance(message.foo, Foo)
|
||||
assert isinstance(message2.foo, Foo)
|
||||
assert not hasattr(message, "foo")
|
||||
assert object.__getattribute__(message, "foo") == betterproto.PLACEHOLDER
|
||||
assert not hasattr(message2, "foo")
|
||||
assert object.__getattribute__(message2, "foo") == betterproto.PLACEHOLDER
|
||||
|
||||
assert isinstance(message_reference.foo, ReferenceFoo)
|
||||
assert isinstance(message_reference2.foo, ReferenceFoo)
|
||||
|
Reference in New Issue
Block a user