1 from unittest
import main
2 from datetime
import datetime
3 from gnucash
import Book, Account, Split, GncCommodity, GncNumeric, \
6 from test_book
import BookSession
10 BookSession.setUp(self)
16 self.assertEqual(
'', self.
account.GetName() )
18 self.assertEqual( NAME, self.
account.GetName() )
21 SPLIT = Split(self.
book)
22 self.assertTrue(self.
account.insert_split(SPLIT))
23 self.assertTrue(self.
account.remove_split(SPLIT))
25 def test_assignlots(self):
26 abc = GncCommodity(self.
book,
'ABC Fund',
27 'COMMODITY',
'ABC',
'ABC',100000)
28 self.
table.insert(abc)
31 other = Account(self.
book)
34 tx = Transaction(self.
book)
37 tx.SetDateEnteredSecs(datetime.now())
38 tx.SetDatePostedSecs(datetime.now())
40 s1a = Split(self.
book)
43 s1a.SetAmount(GncNumeric(1.3))
44 s1a.SetValue(GncNumeric(100.0))
46 s1b = Split(self.
book)
49 s1b.SetAmount(GncNumeric(-100.0))
50 s1b.SetValue(GncNumeric(-100.0))
52 s2a = Split(self.
book)
55 s2a.SetAmount(GncNumeric(-1.3))
56 s2a.SetValue(GncNumeric(-100.0))
58 s2b = Split(self.
book)
61 s2b.SetAmount(GncNumeric(100.0))
62 s2b.SetValue(GncNumeric(100.0))
67 self.assertEqual(len(self.
account.GetLotList()),1)
69 if __name__ ==
'__main__':