Fix to_string_with_decimal_point_placed

>>> nominator='123456'
A digit is missing in the string returned from to_string_with_decimal_point_placed. The -1 error.
>>> point_place=2
>>> nominator[:-point_place - 1], nominator[-point_place:]
('123', '56')
This commit is contained in:
koldavi 2021-04-01 13:26:15 +02:00 committed by GitHub
parent 4e8b0f8522
commit 506fd57989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ def to_string_with_decimal_point_placed(number: GncNumeric):
if len(nominator) <= point_place: # prepending zeros if the nominator is too short
nominator = '0' * (point_place - len(nominator)) + nominator
return '.'.join([nominator[:-point_place - 1], nominator[-point_place:]])
return '.'.join([nominator[:-point_place], nominator[-point_place:]])
if __name__ == '__main__':