python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

tests: add an encoding roundtrip for Struct

Open woodruffw opened this issue 1 year ago • 1 comments

Summary

Follows #551. This currently fails, as expected, since dump() is not correctly specialized for Struct.

This is a work in progress.

Checklist

  • [x] If code changes were made then they have been tested.
    • [ ] I have updated the documentation to reflect the changes.
  • [x] This PR fixes an issue.
  • [ ] This PR adds something new (e.g. new method or parameters).
    • [x] This change has an associated test.
  • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • [ ] This PR is not a code change (e.g. documentation, README, ...)

woodruffw avatar Feb 25 '24 17:02 woodruffw

Just to post a brief update: per https://github.com/danielgtaylor/python-betterproto/pull/551#issuecomment-1972061214 and below, I don't yet have a great idea for a patch here. The basic thing that needs to happen is that dump() and load() need to be specialized for Struct, but doing so is weird because Struct is not referentially transparent against the underlying map<string, ...> type it contains.

woodruffw avatar Mar 04 '24 21:03 woodruffw