Skip to content

tests: add an encoding roundtrip for Struct #559

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/test_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def test_struct_roundtrip():
assert struct_from_dict.to_dict() == data
assert struct_from_dict.to_json() == data_json

struct_from_proto = Struct().parse(bytes(struct_from_dict))
assert struct_from_proto.fields == data
assert struct_from_proto.to_dict() == data
assert struct_from_proto.to_json() == data_json

struct_from_json = Struct().from_json(data_json)
assert struct_from_json.fields == data
assert struct_from_json.to_dict() == data
Expand Down