Skip to content

Conversation

@chuckwondo
Copy link

Fixes #723

Comment on lines +4064 to +4074
def test_unset_encode_struct_array_like(self, proto):
class Ex(Struct, array_like=True):
x: Union[int, UnsetType] = UNSET
y: Union[int, UnsetType] = UNSET
z: int = 0

for x, y in [(Ex(), [0]), (Ex(x=1), [1, 0]), (Ex(y=2), [2, 0])]:
res = proto.encode(x)
sol = proto.encode(y)
assert res == sol

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need another assertion here:

roundtrip = proto.decode(res, type=Ex) assert roundtrip == res

And add a z case for good measure.

What good is it to speak, if we will be misunderstood?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants