Files
Beancount-importer/test_amount_parsing.py

21 lines
611 B
Python
Raw Permalink Normal View History

import unittest
from beancount.core.amount import D
class TestAmountParsing(unittest.TestCase):
def clean_bedrag_str(self, bedrag_str):
bedrag_str = bedrag_str.replace('.','')
bedrag_str = bedrag_str.replace(',', '.')
return bedrag_str
# Europese notatie - het werkt dus prima
def test_correct_amount_parsing(self):
test_bedrag = "1.699,62"
expected_decimal = D("1699.62")
cleaned_string = self.clean_bedrag_str(test_bedrag)
self.assertEqual(D(cleaned_string), expected_decimal)
if __name__ == '__main__':
unittest.main()