From 68a45a194bb07d7b9cd90bf6c04192c4aed0310a Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Wed, 15 Jan 2014 10:37:25 -0800 Subject: [PATCH] Add test showing off using a dictionary in new_message --- test/test_struct.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_struct.py b/test/test_struct.py index fc013e2..ad6fbee 100644 --- a/test/test_struct.py +++ b/test/test_struct.py @@ -122,6 +122,15 @@ def test_new_message(all_types): assert msg.structList[0].int32Field == 100 assert msg.structList[1].int32Field == 101 + msg = all_types.TestAllTypes.new_message(int32Field=100) + + assert msg.int32Field == 100 + + msg = all_types.TestAllTypes.new_message(**{'int32Field': 100, 'int64Field': 101}) + + assert msg.int32Field == 100 + assert msg.int64Field == 101 + def test_set_dict(all_types): msg = all_types.TestAllTypes.new_message()