Skip to content

Commit dfa0a56

Browse files
Simplify standard tests by using 1 json per case.
1 parent dd4873d commit dfa0a56

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

betterproto/tests/inputs/int32/int32-negative.json

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"count": 150
2+
"positive": 150,
3+
"negative": -150
34
}

betterproto/tests/inputs/int32/int32.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ syntax = "proto3";
33
// Some documentation about the Test message.
44
message Test {
55
// Some documentation about the count.
6-
int32 count = 1;
6+
int32 positive = 1;
7+
int32 negative = 2;
78
}

betterproto/tests/inputs/signed/signed-negative.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"signed_32": 150,
3-
"signed_64": "150"
2+
"signed32": 150,
3+
"negative32": -150,
4+
"string64": "150",
5+
"negative64": "-150"
46
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
syntax = "proto3";
22

33
message Test {
4-
sint32 signed_32 = 1;
5-
sint64 signed_64 = 2;
4+
// todo: rename fields after fixing bug where 'signed_32_positive' will map to 'signed_32Positive' as output json
5+
sint32 signed32 = 1; // signed_32_positive
6+
sint32 negative32 = 2; // signed_32_negative
7+
sint64 string64 = 3; // signed_64_positive
8+
sint64 negative64 = 4; // signed_64_negative
69
}

betterproto/tests/test_inputs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ def test_message_json(test_case_name: str) -> None:
5050
message.from_json(reference_json_data)
5151
message_json = message.to_json(0)
5252

53-
assert json.loads(message_json) == json.loads(reference_json_data)
53+
print(reference_json_data)
54+
print(message_json)
55+
56+
assert json.loads(reference_json_data) == json.loads(message_json)
57+
58+
# todo: handle -negative
5459

5560

5661
@pytest.mark.parametrize("test_case_name", test_case_names)

0 commit comments

Comments
 (0)