()
| 75 | |
| 76 | |
| 77 | def test_class_init(): |
| 78 | @dataclass |
| 79 | class Bar(betterproto.Message): |
| 80 | name: str = betterproto.string_field(1) |
| 81 | |
| 82 | @dataclass |
| 83 | class Foo(betterproto.Message): |
| 84 | name: str = betterproto.string_field(1) |
| 85 | child: Bar = betterproto.message_field(2) |
| 86 | |
| 87 | foo = Foo(name="foo", child=Bar(name="bar")) |
| 88 | |
| 89 | assert foo.to_dict() == {"name": "foo", "child": {"name": "bar"}} |
| 90 | assert foo.to_pydict() == {"name": "foo", "child": {"name": "bar"}} |
| 91 | |
| 92 | |
| 93 | def test_enum_as_int_json(): |