GnuCash fec5643+
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 231 of file test_price_and_wrapping.py.

Member Function Documentation

◆ setUp()

test_price_and_wrapping.TestSplitGncNumericReturns.setUp (   self)

Definition at line 234 of file test_price_and_wrapping.py.

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

◆ tearDown()

test_price_and_wrapping.TestSplitGncNumericReturns.tearDown (   self)

Definition at line 269 of file test_price_and_wrapping.py.

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

◆ test_get_cap_gains_returns_gnc_numeric()

test_price_and_wrapping.TestSplitGncNumericReturns.test_get_cap_gains_returns_gnc_numeric (   self)

Definition at line 276 of file test_price_and_wrapping.py.

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

◆ test_get_noclosing_balance_returns_gnc_numeric()

test_price_and_wrapping.TestSplitGncNumericReturns.test_get_noclosing_balance_returns_gnc_numeric (   self)

Definition at line 272 of file test_price_and_wrapping.py.

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

Field Documentation

◆ book

test_price_and_wrapping.TestSplitGncNumericReturns.book

Definition at line 236 of file test_price_and_wrapping.py.

◆ ses

test_price_and_wrapping.TestSplitGncNumericReturns.ses

Definition at line 235 of file test_price_and_wrapping.py.

◆ split

test_price_and_wrapping.TestSplitGncNumericReturns.split

Definition at line 255 of file test_price_and_wrapping.py.


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