diff options
author | John Wiegley <johnw@newartisans.com> | 2012-04-26 16:39:25 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-04-26 16:39:25 -0500 |
commit | 64a9b42381c26baf24e58b40f50f0b253e551811 (patch) | |
tree | 5447a29dff64c3a8b7be8100a01bcb4a2d73b0bb /test/python | |
parent | 7cc550fc22357e2ded194d3e65287c6b3317f5ae (diff) | |
parent | b4407c10c0071365322b2963747bf42a57fd7304 (diff) | |
download | fork-ledger-64a9b42381c26baf24e58b40f50f0b253e551811.tar.gz fork-ledger-64a9b42381c26baf24e58b40f50f0b253e551811.tar.bz2 fork-ledger-64a9b42381c26baf24e58b40f50f0b253e551811.zip |
Merge branch 'release/v3.0.0-20120426'
Diffstat (limited to 'test/python')
-rw-r--r-- | test/python/JournalTest.py | 30 | ||||
-rw-r--r-- | test/python/PostingTest.py | 25 | ||||
-rw-r--r-- | test/python/TransactionTest.py | 25 | ||||
-rw-r--r-- | test/python/UnitTests.py | 12 |
4 files changed, 92 insertions, 0 deletions
diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py new file mode 100644 index 00000000..e65c671d --- /dev/null +++ b/test/python/JournalTest.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import unittest + +from ledger import * + +class JournalTestCase(unittest.TestCase): + def tearDown(self): + 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") + + 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) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/PostingTest.py b/test/python/PostingTest.py new file mode 100644 index 00000000..f191253e --- /dev/null +++ b/test/python/PostingTest.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +import unittest +import exceptions +import operator + +from ledger import * +from StringIO import * +from datetime import * + +class PostingTestCase(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_(self): + pass + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(PostingTestCase) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/TransactionTest.py b/test/python/TransactionTest.py new file mode 100644 index 00000000..66447f87 --- /dev/null +++ b/test/python/TransactionTest.py @@ -0,0 +1,25 @@ +# -*- 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 + + def test_(self): + pass + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/UnitTests.py b/test/python/UnitTests.py new file mode 100644 index 00000000..388e2229 --- /dev/null +++ b/test/python/UnitTests.py @@ -0,0 +1,12 @@ +from unittest import TextTestRunner, TestSuite + +import JournalTest +import TransactionTest +import PostingTest + +suites = [ + JournalTest.suite(), + TransactionTest.suite(), + PostingTest.suite() +] +TextTestRunner().run(TestSuite(suites)) |