1 from unittest
import main
3 from gnucash
import Book, Account, Split, Transaction
4 from unittest_support
import *
6 from test_book
import BookSession
11 BookSession.setUp(self)
17 class TestSplit( SplitSession ):
19 MEMO =
"cookie monster"
20 self.assertEquals(
'', self.split.GetMemo() )
21 self.split.SetMemo(MEMO)
22 self.assertEquals( MEMO, self.split.GetMemo() )
26 ACCT.SetCommodity(self.currency)
27 self.split.SetAccount(ACCT)
28 self.assertTrue( ACCT.Equal(self.split.GetAccount(),
True) )
31 domain1 =
"gnc.engine.scrub"
32 msg1 =
"[xaccScrubUtilityGetOrMakeAccount()] No currency specified!"
33 level = G_LOG_LEVEL_CRITICAL
35 check1.log_domain = domain1
36 check1.log_level = level
38 hdlr1 = test_set_checked_handler(domain1, level, check1)
39 domain2 =
"gnc.engine"
40 msg2 =
"[xaccTransScrubSplits()] Transaction doesn't have a currency!"
41 level = G_LOG_LEVEL_CRITICAL
43 check2.log_domain = domain2
44 check2.log_level = level
46 hdlr2 = test_set_checked_handler(domain2, level, check2)
49 self.split.SetParent(TRANS)
50 TRANS.SetCurrency(self.currency)
51 TRANS.SetDescription(
"Foo")
52 self.assertEquals( TRANS.GetDescription(), self.split.GetParent().GetDescription() )
54 g_log_remove_handler(domain2, hdlr2)
55 g_log_remove_handler(domain1, hdlr1)
59 self.assertTrue( self.split.Equal(COPY,
True,
False,
False) )
61 if __name__ ==
'__main__':
struct account_s Account
Account in Gnucash. This is the typename for an account. The actual structure is defined in the priva...
struct split_s Split
Split in Gnucash. A "split" is more commonly referred to as a "entry" in a "transaction". Each split belongs to one Account and one Transaction. The split is one out of several parts a Transaction is divided into.
struct transaction_s Transaction
Transaction in Gnucash. A Transaction is a piece of business done; the transfer of money from one acc...