File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -102,9 +102,9 @@ def __post_init__(self):
102
102
self .json_parameter_type = _JSON_PARAMETER_TYPE_STRING
103
103
elif isinstance (self .value , bool ):
104
104
self .json_parameter_type = _JSON_PARAMETER_TYPE_BOOLEAN
105
- elif isinstance (self .value , int ):
106
- self . json_parameter_type = _JSON_PARAMETER_TYPE_INTEGER
107
- elif isinstance ( self . value , float ):
105
+ elif isinstance (self .value , float ) or isinstance ( self . value , int ):
106
+ # Default number values may not be representative of whether calculated values are integer-only,
107
+ # so we specify number type even if value is int.
108
108
self .json_parameter_type = _JSON_PARAMETER_TYPE_NUMBER
109
109
elif isinstance (self .value , dict ):
110
110
self .json_parameter_type = _JSON_PARAMETER_TYPE_OBJECT
Original file line number Diff line number Diff line change @@ -154,7 +154,8 @@ def test_output_parameter_with_preferred_units(self):
154
154
def test_output_parameter_json_types (self ):
155
155
cases = [
156
156
('foo' , 'string' ),
157
- (1 , 'integer' ),
157
+ (1 , 'number' ),
158
+ (44.4 , 'number' ),
158
159
(True , 'boolean' ),
159
160
([1 , 2 , 3 ], 'array' ),
160
161
({4 , 5 , 6 }, 'array' ),
You can’t perform that action at this time.
0 commit comments