GnuCash
5.6-150-g038405b370+
bindings
python
tests
test_commodity.py
1
from
unittest
import
TestCase, main
2
3
from
gnucash
import
Session
4
5
class
CommoditySession
(TestCase):
6
def
setUp(self):
7
self.
ses
= Session()
8
self.
book
= self.
ses
.get_book()
9
self.
table
= self.
book
.get_table()
10
11
def
tearDown(self):
12
self.
ses
.end()
13
14
class
TestCommodity
(
CommoditySession
):
15
def
test_iso_currency(self):
16
eur = self.
table
.lookup(
'CURRENCY'
,
'EUR'
)
17
self.assertIsNotNone(eur)
18
19
class
TestCommodityNamespace
(
CommoditySession
):
20
def
test_namespaces(self):
21
#print(self.table.__class__)
22
namespace_names = self.
table
.get_namespaces()
23
#print(namespace_names)
24
self.assertEqual(namespace_names, [
'template'
,
'CURRENCY'
])
25
26
def
test_namespaces_list(self):
27
namespaces = self.
table
.get_namespaces_list()
28
namespace_names = [ns.get_name()
for
ns
in
namespaces]
29
self.assertEqual(namespace_names, [
'template'
,
'CURRENCY'
])
30
31
if
__name__ ==
'__main__'
:
32
main()
test_commodity.CommoditySession
Definition:
test_commodity.py:5
test_commodity.TestCommodity
Definition:
test_commodity.py:14
test_commodity.TestCommodityNamespace
Definition:
test_commodity.py:19
test_commodity.CommoditySession.table
table
Definition:
test_commodity.py:9
test_commodity.CommoditySession.ses
ses
Definition:
test_commodity.py:7
test_commodity.CommoditySession.book
book
Definition:
test_commodity.py:8
Generated by
1.8.14