diff options
author | David Sklar <177495+davidsklar@users.noreply.github.com> | 2022-12-29 13:45:37 -0500 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2023-01-10 09:15:59 +0800 |
commit | 0ade3a55fb84f5d899bcdac3f92dd9af6b370c66 (patch) | |
tree | dc8e57f7f1d398c2136be9586e239b3c59096424 /test | |
parent | c43098d5bd91b6af733cb19225ebaf29228c2c50 (diff) | |
download | fork-ledger-0ade3a55fb84f5d899bcdac3f92dd9af6b370c66.tar.gz fork-ledger-0ade3a55fb84f5d899bcdac3f92dd9af6b370c66.tar.bz2 fork-ledger-0ade3a55fb84f5d899bcdac3f92dd9af6b370c66.zip |
Python: Transaction.remove_post should call xact_base_t::remove_post
Diffstat (limited to 'test')
-rw-r--r-- | test/python/TransactionTest.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/python/TransactionTest.py b/test/python/TransactionTest.py index 257eb377..6827720d 100644 --- a/test/python/TransactionTest.py +++ b/test/python/TransactionTest.py @@ -6,18 +6,33 @@ import operator from ledger import * from datetime import * -class JournalTestCase(unittest.TestCase): +class TransactionTestCase(unittest.TestCase): def setUp(self): - pass + self.journal = read_journal_from_string(""" +2012-03-01 KFC + Expenses:Food $21.34 + Assets:Cash +2012-03-02 MJT + Expenses:Museum $45.67 + Assets:Cash +""") def tearDown(self): close_journal_files() - def test_(self): - pass - + def testAddRemovePosts(self): + xacts = [xact for xact in self.journal] + x1_posts = [post for post in xacts[1]] + for post in x1_posts: + xacts[0].add_post(post) + xacts[1].remove_post(post) + x0_posts = [post for post in xacts[0]] + x1_posts = [post for post in xacts[1]] + self.assertEqual(len(x0_posts), 4) + self.assertEqual(len(x1_posts), 0) + def suite(): - return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase) + return unittest.TestLoader().loadTestsFromTestCase(TransactionTestCase) if __name__ == '__main__': unittest.main() |