summaryrefslogtreecommitdiff
path: root/test/python/JournalTest.py
diff options
context:
space:
mode:
authorMartin Michlmayr <tbm@cyrius.com>2019-02-05 08:27:25 -0500
committerMartin Michlmayr <tbm@cyrius.com>2019-02-05 08:27:25 -0500
commit0bbb976ee3064ff59b319e30fd97e31020259760 (patch)
tree5d13986511c18d911b0d1b2dc498b0f81d3a3b0e /test/python/JournalTest.py
parent9de94d4adb7a566af38814f9d37e26c559b68b4f (diff)
parent7a5871d3b53e66ee261bea4b41512e99269b18b1 (diff)
downloadfork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.tar.gz
fork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.tar.bz2
fork-ledger-0bbb976ee3064ff59b319e30fd97e31020259760.zip
Merge branch 'next' into release/3.1.2
Diffstat (limited to 'test/python/JournalTest.py')
-rw-r--r--test/python/JournalTest.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py
index e65c671d..2565ede8 100644
--- a/test/python/JournalTest.py
+++ b/test/python/JournalTest.py
@@ -22,6 +22,24 @@ class JournalTestCase(unittest.TestCase):
for post in journal.query("food"):
self.assertEqual(str(post.account), "Expenses:Food")
self.assertEqual(post.amount, Amount("$21.34"))
+
+ def testParseError(self):
+ # TODO: ledger spits out parse errors to standard out.
+ # This should not happen, especially when the error
+ # has already been captured by a Python exception.
+ def fun():
+ read_journal_from_string("""
+2012-03-01 KFC
+ Expenses:Food rsnetnirsnti
+ Assets:Cash
+""")
+ self.assertRaises(RuntimeError, fun)
+ try:
+ fun()
+ except RuntimeError as e:
+ self.assertEquals(str(e).splitlines()[-1],
+ "No quantity specified for amount")
+
def suite():
return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase)