Properly serialize zero-value messages in a oneof group (#176)
Also improve test utils to make it easier to have multiple json examples. Co-authored-by: Christopher Chambers <chris@peanutcode.com>
This commit is contained in:
		| @@ -5,11 +5,11 @@ from tests.util import get_test_case_json_data | ||||
|  | ||||
| def test_which_count(): | ||||
|     message = Test() | ||||
|     message.from_json(get_test_case_json_data("oneof")) | ||||
|     message.from_json(get_test_case_json_data("oneof")[0]) | ||||
|     assert betterproto.which_one_of(message, "foo") == ("count", 100) | ||||
|  | ||||
|  | ||||
| def test_which_name(): | ||||
|     message = Test() | ||||
|     message.from_json(get_test_case_json_data("oneof", "oneof-name.json")) | ||||
|     message.from_json(get_test_case_json_data("oneof", "oneof_name.json")[0]) | ||||
|     assert betterproto.which_one_of(message, "foo") == ("name", "foobar") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user