File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,7 @@ def json_serialize(obj):
121
121
:return: string representation for json.dump or json.dumps
122
122
"""
123
123
if isinstance (obj , Decimal ):
124
- numerator , denumerator = obj .as_integer_ratio ()
125
- if denumerator == 1 :
126
- return str (numerator )
127
- else :
128
- return str (obj )
124
+ return str (obj )
129
125
elif isinstance (obj , bytes ):
130
126
return str (obj )
131
127
else :
Original file line number Diff line number Diff line change @@ -109,6 +109,6 @@ def test_index():
109
109
110
110
def test_json_serialize ():
111
111
assert json_serialize (Decimal ('3.1415926' )) == '3.1415926'
112
- assert json_serialize (Decimal ('11.0' )) == '11'
112
+ assert json_serialize (Decimal ('11.0' )) == '11.0 '
113
113
assert json_serialize (b'123' ) == "b'123'"
114
114
assert json_serialize (11 ) == '11'
You can’t perform that action at this time.
0 commit comments