Simplify standard tests by using 1 json per case.

This commit is contained in:
boukeversteegh 2020-05-22 20:58:14 +02:00
parent dd4873dfba
commit dfa0a56b39
7 changed files with 19 additions and 14 deletions

View File

@ -1,3 +0,0 @@
{
"count": -150
}

View File

@ -1,3 +1,4 @@
{
"count": 150
"positive": 150,
"negative": -150
}

View File

@ -3,5 +3,6 @@ syntax = "proto3";
// Some documentation about the Test message.
message Test {
// Some documentation about the count.
int32 count = 1;
int32 positive = 1;
int32 negative = 2;
}

View File

@ -1,4 +0,0 @@
{
"signed_32": -150,
"signed_64": "-150"
}

View File

@ -1,4 +1,6 @@
{
"signed_32": 150,
"signed_64": "150"
"signed32": 150,
"negative32": -150,
"string64": "150",
"negative64": "-150"
}

View File

@ -1,6 +1,9 @@
syntax = "proto3";
message Test {
sint32 signed_32 = 1;
sint64 signed_64 = 2;
// todo: rename fields after fixing bug where 'signed_32_positive' will map to 'signed_32Positive' as output json
sint32 signed32 = 1; // signed_32_positive
sint32 negative32 = 2; // signed_32_negative
sint64 string64 = 3; // signed_64_positive
sint64 negative64 = 4; // signed_64_negative
}

View File

@ -50,7 +50,12 @@ def test_message_json(test_case_name: str) -> None:
message.from_json(reference_json_data)
message_json = message.to_json(0)
assert json.loads(message_json) == json.loads(reference_json_data)
print(reference_json_data)
print(message_json)
assert json.loads(reference_json_data) == json.loads(message_json)
# todo: handle -negative
@pytest.mark.parametrize("test_case_name", test_case_names)