diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-01 05:50:07 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-01 05:50:07 -0600 |
commit | 9ec9cdf41e5176f7fcf06da5f75593d9ba3d4028 (patch) | |
tree | f9536d691ef7c5abea82349a0b58a5f5e3cf8e33 /test/python | |
parent | 944e580825f0d9ce060b6dcdffe8990b6c2cca20 (diff) | |
download | fork-ledger-9ec9cdf41e5176f7fcf06da5f75593d9ba3d4028.tar.gz fork-ledger-9ec9cdf41e5176f7fcf06da5f75593d9ba3d4028.tar.bz2 fork-ledger-9ec9cdf41e5176f7fcf06da5f75593d9ba3d4028.zip |
Started writing Python unit tests
Diffstat (limited to 'test/python')
-rw-r--r-- | test/python/JournalTest.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py index 66447f87..e65c671d 100644 --- a/test/python/JournalTest.py +++ b/test/python/JournalTest.py @@ -1,22 +1,27 @@ # -*- coding: utf-8 -*- import unittest -import exceptions -import operator from ledger import * -from StringIO import * -from datetime import * class JournalTestCase(unittest.TestCase): - def setUp(self): - pass - def tearDown(self): - pass + session.close_journal_files() + + def testBasicRead(self): + journal = read_journal_from_string(""" +2012-03-01 KFC + Expenses:Food $21.34 + Assets:Cash +""") + self.assertEqual(type(journal), Journal) + + for xact in journal: + self.assertEqual(xact.payee, "KFC") - def test_(self): - pass + for post in journal.query("food"): + self.assertEqual(str(post.account), "Expenses:Food") + self.assertEqual(post.amount, Amount("$21.34")) def suite(): return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase) |