MCPcopy
hub / github.com/danielgtaylor/python-betterproto / test_message_json

Function test_message_json

tests/test_inputs.py:177–192  ·  view source on GitHub ↗
(repeat, test_data: TestData)

Source from the content-addressed store, hash-verified

175
176@pytest.mark.parametrize("test_data", test_cases.messages_with_json, indirect=True)
177def test_message_json(repeat, test_data: TestData) -> None:
178 plugin_module, _, json_data = test_data
179
180 for _ in range(repeat):
181 for sample in json_data:
182 if sample.belongs_to(test_input_config.non_symmetrical_json):
183 continue
184
185 message: betterproto.Message = plugin_module.Test()
186
187 message.from_json(sample.json)
188 message_json = message.to_json(0)
189
190 assert dict_replace_nans(json.loads(message_json)) == dict_replace_nans(
191 json.loads(sample.json)
192 )
193
194
195@pytest.mark.parametrize("test_data", test_cases.services, indirect=True)

Callers

nothing calls this directly

Calls 4

dict_replace_nansFunction · 0.85
belongs_toMethod · 0.80
from_jsonMethod · 0.80
to_jsonMethod · 0.80

Tested by

no test coverage detected