21 lines
611 B
Python
21 lines
611 B
Python
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()
|