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

Public Member Functions

 test_lookup_latest_returns_gnc_price (self)
 
 test_nth_price_returns_gnc_price (self)
 
 test_get_commodity_returns_gnc_commodity (self)
 
 test_get_currency_returns_gnc_commodity (self)
 
 test_get_value_returns_gnc_numeric (self)
 
 test_clone_returns_gnc_price (self)
 
 test_lookup_latest_any_currency_returns_list_of_gnc_price (self)
 
 test_get_prices_returns_list_of_gnc_price (self)
 
 test_lookup_nearest_in_time_any_currency (self)
 
 test_lookup_nearest_before_any_currency (self)
 
- Public Member Functions inherited from test_price_and_wrapping.PriceSession
 setUp (self)
 
 tearDown (self)
 

Data Fields

 test_comm
 
- Data Fields inherited from test_price_and_wrapping.PriceSession
 ses
 
 book
 
 table
 
 usd
 
 test_comm
 
 pricedb
 
 price1
 
 price2
 

Detailed Description

Verify that GncPrice / GncPriceDB methods return properly wrapped
Python objects instead of raw SwigPyObjects.

Definition at line 68 of file test_price_and_wrapping.py.

Member Function Documentation

◆ test_clone_returns_gnc_price()

test_price_and_wrapping.TestGncPriceWrapping.test_clone_returns_gnc_price (   self)

Definition at line 104 of file test_price_and_wrapping.py.

104 def test_clone_returns_gnc_price(self):
105 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
106 self.assertIsNotNone(price)
107 cloned = price.clone(self.book)
108 self.assertIsInstance(cloned, GncPrice)
109

◆ test_get_commodity_returns_gnc_commodity()

test_price_and_wrapping.TestGncPriceWrapping.test_get_commodity_returns_gnc_commodity (   self)

Definition at line 86 of file test_price_and_wrapping.py.

86 def test_get_commodity_returns_gnc_commodity(self):
87 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
88 self.assertIsNotNone(price)
89 comm = price.get_commodity()
90 self.assertIsInstance(comm, GncCommodity)
91

◆ test_get_currency_returns_gnc_commodity()

test_price_and_wrapping.TestGncPriceWrapping.test_get_currency_returns_gnc_commodity (   self)

Definition at line 92 of file test_price_and_wrapping.py.

92 def test_get_currency_returns_gnc_commodity(self):
93 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
94 self.assertIsNotNone(price)
95 curr = price.get_currency()
96 self.assertIsInstance(curr, GncCommodity)
97

◆ test_get_prices_returns_list_of_gnc_price()

test_price_and_wrapping.TestGncPriceWrapping.test_get_prices_returns_list_of_gnc_price (   self)

Definition at line 120 of file test_price_and_wrapping.py.

120 def test_get_prices_returns_list_of_gnc_price(self):
121 prices = self.pricedb.get_prices(self.test_comm, self.usd)
122 self.assertIsInstance(prices, list)
123 self.assertGreater(len(prices), 0)
124 for p in prices:
125 self.assertIsInstance(p, GncPrice)
126

◆ test_get_value_returns_gnc_numeric()

test_price_and_wrapping.TestGncPriceWrapping.test_get_value_returns_gnc_numeric (   self)

Definition at line 98 of file test_price_and_wrapping.py.

98 def test_get_value_returns_gnc_numeric(self):
99 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
100 self.assertIsNotNone(price)
101 val = price.get_value()
102 self.assertIsInstance(val, GncNumeric)
103

◆ test_lookup_latest_any_currency_returns_list_of_gnc_price()

test_price_and_wrapping.TestGncPriceWrapping.test_lookup_latest_any_currency_returns_list_of_gnc_price (   self)

Definition at line 112 of file test_price_and_wrapping.py.

112 def test_lookup_latest_any_currency_returns_list_of_gnc_price(self):
113 prices = self.pricedb.lookup_latest_any_currency(self.test_comm)
114 self.assertIsInstance(prices, list)
115 self.assertGreater(len(prices), 0,
116 "Expected at least one price for TSTK")
117 for p in prices:
118 self.assertIsInstance(p, GncPrice)
119

◆ test_lookup_latest_returns_gnc_price()

test_price_and_wrapping.TestGncPriceWrapping.test_lookup_latest_returns_gnc_price (   self)

Definition at line 74 of file test_price_and_wrapping.py.

74 def test_lookup_latest_returns_gnc_price(self):
75 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
76 self.assertIsNotNone(price, "No price found for TSTK/USD")
77 self.assertIsInstance(price, GncPrice)
78

◆ test_lookup_nearest_before_any_currency()

test_price_and_wrapping.TestGncPriceWrapping.test_lookup_nearest_before_any_currency (   self)

Definition at line 135 of file test_price_and_wrapping.py.

135 def test_lookup_nearest_before_any_currency(self):
136 date = datetime(2025, 7, 1)
137 prices = self.pricedb.lookup_nearest_before_any_currency_t64(
138 self.test_comm, date)
139 self.assertIsInstance(prices, list)
140 for p in prices:
141 self.assertIsInstance(p, GncPrice)
142
143
144# ---------------------------------------------------------------------------
145# Test: GncLot.get_split_list
146# ---------------------------------------------------------------------------

◆ test_lookup_nearest_in_time_any_currency()

test_price_and_wrapping.TestGncPriceWrapping.test_lookup_nearest_in_time_any_currency (   self)

Definition at line 127 of file test_price_and_wrapping.py.

127 def test_lookup_nearest_in_time_any_currency(self):
128 date = datetime(2025, 1, 20)
129 prices = self.pricedb.lookup_nearest_in_time_any_currency_t64(
130 self.test_comm, date)
131 self.assertIsInstance(prices, list)
132 for p in prices:
133 self.assertIsInstance(p, GncPrice)
134

◆ test_nth_price_returns_gnc_price()

test_price_and_wrapping.TestGncPriceWrapping.test_nth_price_returns_gnc_price (   self)

Definition at line 79 of file test_price_and_wrapping.py.

79 def test_nth_price_returns_gnc_price(self):
80 price = self.pricedb.nth_price(self.test_comm, 0)
81 self.assertIsNotNone(price, "nth_price(TSTK, 0) returned None")
82 self.assertIsInstance(price, GncPrice)
83

Field Documentation

◆ test_comm

test_price_and_wrapping.TestGncPriceWrapping.test_comm

Definition at line 130 of file test_price_and_wrapping.py.


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