GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
test_account.TestAccount Class Reference
Inheritance diagram for test_account.TestAccount:
test_account.AccountSession test_book.BookSession

Public Member Functions

 test_name (self)
 
 test_online_id (self)
 
 test_split (self)
 
 test_assignlots (self)
 

Data Fields

 currency
 
 account
 
- Data Fields inherited from test_book.BookSession
 ses
 
 book
 
 table
 
 currency
 

Detailed Description

Definition at line 13 of file test_account.py.

Member Function Documentation

◆ test_assignlots()

test_account.TestAccount.test_assignlots (   self)

Definition at line 34 of file test_account.py.

34 def test_assignlots(self):
35 abc = GncCommodity(self.book, 'ABC Fund',
36 'COMMODITY','ABC','ABC',100000)
37 self.table.insert(abc)
38 self.account.SetCommodity(abc)
39
40 other = Account(self.book)
41 other.SetCommodity(self.currency)
42
43 tx = Transaction(self.book)
44 tx.BeginEdit()
45 tx.SetCurrency(self.currency)
46 tx.SetDateEnteredSecs(datetime.now())
47 tx.SetDatePostedSecs(datetime.now())
48
49 s1a = Split(self.book)
50 s1a.SetParent(tx)
51 s1a.SetAccount(self.account)
52 s1a.SetAmount(GncNumeric(1.3))
53 s1a.SetValue(GncNumeric(100.0))
54
55 s1b = Split(self.book)
56 s1b.SetParent(tx)
57 s1b.SetAccount(other)
58 s1b.SetAmount(GncNumeric(-100.0))
59 s1b.SetValue(GncNumeric(-100.0))
60
61 s2a = Split(self.book)
62 s2a.SetParent(tx)
63 s2a.SetAccount(self.account)
64 s2a.SetAmount(GncNumeric(-1.3))
65 s2a.SetValue(GncNumeric(-100.0))
66
67 s2b = Split(self.book)
68 s2b.SetParent(tx)
69 s2b.SetAccount(other)
70 s2b.SetAmount(GncNumeric(100.0))
71 s2b.SetValue(GncNumeric(100.0))
72
73 tx.CommitEdit()
74
75 self.account.ScrubLots()
76 self.assertEqual(len(self.account.GetLotList()),1)
77
The primary numeric class for representing amounts and values.
STRUCTS.

◆ test_name()

test_account.TestAccount.test_name (   self)

Definition at line 14 of file test_account.py.

14 def test_name(self):
15 NAME = "Money"
16 self.assertEqual( '', self.account.GetName() )
17 self.account.SetName(NAME)
18 self.assertEqual( NAME, self.account.GetName() )
19

◆ test_online_id()

test_account.TestAccount.test_online_id (   self)

Definition at line 20 of file test_account.py.

20 def test_online_id(self):
21 ONLINE_ID = "061000104:0123456789:CHECKING"
22 self.assertEqual( None, self.account.GetOnlineID() )
23 self.account.SetOnlineID(ONLINE_ID)
24 self.assertEqual( ONLINE_ID, self.account.GetOnlineID() )
25 # Passing None (or "") clears it.
26 self.account.SetOnlineID(None)
27 self.assertEqual( None, self.account.GetOnlineID() )
28

◆ test_split()

test_account.TestAccount.test_split (   self)

Definition at line 29 of file test_account.py.

29 def test_split(self):
30 SPLIT = Split(self.book)
31 self.assertTrue(self.account.insert_split(SPLIT))
32 self.assertTrue(self.account.remove_split(SPLIT))
33

Field Documentation

◆ account

test_account.TestAccount.account

Definition at line 51 of file test_account.py.

◆ currency

test_account.TestAccount.currency

Definition at line 41 of file test_account.py.


The documentation for this class was generated from the following file: