python-betterproto/tests/test_mapmessage.py
GrownNed 85e4be96d8
fix Message.to_dict mutating the underlying Message (#378)
* [fix] to_dict modifies the underlying message (#151)

* add test for mapmessage

* fix for to_dict

* formatting

* Apply suggestions from code review

Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>

* change to_json to to_dict

Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
2022-05-09 17:29:42 +01:00

19 lines
356 B
Python

from tests.output_betterproto.mapmessage import (
Nested,
Test,
)
def test_mapmessage_to_dict_preserves_message():
message = Test(
items={
"test": Nested(
count=1,
)
}
)
message.to_dict()
assert isinstance(message.items["test"], Nested), "Wrong nested type after to_dict"