GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
test_price_and_wrapping.TestSplitGncNumericReturns Class Reference
Inheritance diagram for test_price_and_wrapping.TestSplitGncNumericReturns:

Public Member Functions

 setUp (self)
 
 tearDown (self)
 
 test_get_noclosing_balance_returns_gnc_numeric (self)
 
 test_get_cap_gains_returns_gnc_numeric (self)
 

Data Fields

 ses
 
 book
 
 split
 

Detailed Description

Verify that Split methods returning gnc_numeric by value are wrapped.

Definition at line 230 of file test_price_and_wrapping.py.

Member Function Documentation

◆ setUp()

test_price_and_wrapping.TestSplitGncNumericReturns.setUp (   self)

Definition at line 233 of file test_price_and_wrapping.py.

233 def setUp(self):
234 self.ses = Session()
235 self.book = self.ses.get_book()
236 table = self.book.get_table()
237 currency = table.lookup("CURRENCY", "USD")
238
239 root = self.book.get_root_account()
240 acct = Account(self.book)
241 acct.SetCommodity(currency)
242 root.append_child(acct)
243
244 other = Account(self.book)
245 other.SetCommodity(currency)
246 root.append_child(other)
247
248 tx = Transaction(self.book)
249 tx.BeginEdit()
250 tx.SetCurrency(currency)
251 tx.SetDateEnteredSecs(datetime.now())
252 tx.SetDatePostedSecs(datetime.now())
253
254 self.split = Split(self.book)
255 self.split.SetParent(tx)
256 self.split.SetAccount(acct)
257 self.split.SetAmount(GncNumeric(100, 1))
258 self.split.SetValue(GncNumeric(100, 1))
259
260 s2 = Split(self.book)
261 s2.SetParent(tx)
262 s2.SetAccount(other)
263 s2.SetAmount(GncNumeric(-100, 1))
264 s2.SetValue(GncNumeric(-100, 1))
265
266 tx.CommitEdit()
267
The primary numeric class for representing amounts and values.
STRUCTS.

◆ tearDown()

test_price_and_wrapping.TestSplitGncNumericReturns.tearDown (   self)

Definition at line 268 of file test_price_and_wrapping.py.

268 def tearDown(self):
269 self.ses.end()
270

◆ test_get_cap_gains_returns_gnc_numeric()

test_price_and_wrapping.TestSplitGncNumericReturns.test_get_cap_gains_returns_gnc_numeric (   self)

Definition at line 275 of file test_price_and_wrapping.py.

275 def test_get_cap_gains_returns_gnc_numeric(self):
276 val = self.split.GetCapGains()
277 self.assertIsInstance(val, GncNumeric)
278
279
280# ---------------------------------------------------------------------------
281# Test: Account.get_currency_or_parent
282# ---------------------------------------------------------------------------

◆ test_get_noclosing_balance_returns_gnc_numeric()

test_price_and_wrapping.TestSplitGncNumericReturns.test_get_noclosing_balance_returns_gnc_numeric (   self)

Definition at line 271 of file test_price_and_wrapping.py.

271 def test_get_noclosing_balance_returns_gnc_numeric(self):
272 val = self.split.GetNoclosingBalance()
273 self.assertIsInstance(val, GncNumeric)
274

Field Documentation

◆ book

test_price_and_wrapping.TestSplitGncNumericReturns.book

Definition at line 235 of file test_price_and_wrapping.py.

◆ ses

test_price_and_wrapping.TestSplitGncNumericReturns.ses

Definition at line 234 of file test_price_and_wrapping.py.

◆ split

test_price_and_wrapping.TestSplitGncNumericReturns.split

Definition at line 254 of file test_price_and_wrapping.py.


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