summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2018-07-19 22:01:31 -0700
committerJohn Wiegley <johnw@newartisans.com>2018-07-19 22:01:31 -0700
commit5d02402291a923d30e66e4b0a08975ebf22361c3 (patch)
tree1802e52ef0bbbc4ab864564a242f032d22bb8f5f /test
parent8283abb594fa6729b0f32938377cbd6701441ebd (diff)
parent2b981925e5350022569203c045bd31b6d365d995 (diff)
downloadfork-ledger-5d02402291a923d30e66e4b0a08975ebf22361c3.tar.gz
fork-ledger-5d02402291a923d30e66e4b0a08975ebf22361c3.tar.bz2
fork-ledger-5d02402291a923d30e66e4b0a08975ebf22361c3.zip
Merge remote-tracking branch 'origin/master' into next
Diffstat (limited to 'test')
-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)