Added support for infinite and nan floats/doubles (#215)
- Added support for the custom double values from the protobuf json spec: "Infinity", "-Infinity", and "NaN" - Added `infinite_floats` test data - Updated Message.__eq__ to consider nan values equal - Updated `test_message_json` and `test_binary_compatibility` to replace NaN float values in dictionaries before comparison (because two NaN values are not equal)
This commit is contained in:
9
tests/inputs/float/float.json
Normal file
9
tests/inputs/float/float.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"positive": "Infinity",
|
||||
"negative": "-Infinity",
|
||||
"nan": "NaN",
|
||||
"three": 3.0,
|
||||
"threePointOneFour": 3.14,
|
||||
"negThree": -3.0,
|
||||
"negThreePointOneFour": -3.14
|
||||
}
|
||||
12
tests/inputs/float/float.proto
Normal file
12
tests/inputs/float/float.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// Some documentation about the Test message.
|
||||
message Test {
|
||||
double positive = 1;
|
||||
double negative = 2;
|
||||
double nan = 3;
|
||||
double three = 4;
|
||||
double three_point_one_four = 5;
|
||||
double neg_three = 6;
|
||||
double neg_three_point_one_four = 7;
|
||||
}
|
||||
Reference in New Issue
Block a user