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>
This commit is contained in:
18
tests/test_mapmessage.py
Normal file
18
tests/test_mapmessage.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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"
|
Reference in New Issue
Block a user