GnuCash
5.6-150-g038405b370+
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
~
+
Variables
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
Enumerator
Related Functions
+
Files
File List
+
Globals
+
All
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Functions
c
d
f
g
i
n
o
p
q
s
t
u
x
Variables
+
Typedefs
a
b
g
l
o
p
q
s
t
+
Enumerations
c
d
f
g
p
q
r
s
u
+
Enumerator
a
c
d
e
g
n
q
s
t
u
w
+
Macros
a
c
e
f
g
m
n
o
p
q
s
t
v
x
y
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
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