Skip to content

Commit de5fe4a

Browse files
fix error under Python3.6
1 parent 15d1461 commit de5fe4a

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

pysenal/utils/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ def json_serialize(obj):
121121
:return: string representation for json.dump or json.dumps
122122
"""
123123
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)
129125
elif isinstance(obj, bytes):
130126
return str(obj)
131127
else:

tests/utils/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ def test_index():
109109

110110
def test_json_serialize():
111111
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'
113113
assert json_serialize(b'123') == "b'123'"
114114
assert json_serialize(11) == '11'

0 commit comments

Comments
 (0)