mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add basic test for python query
add test for creating query object and setting search_for
related to Bug 796137 and fix in commit 1a7c5b9a32
This commit is contained in:
parent
2d565215cd
commit
54cb3358ce
@ -22,6 +22,7 @@ set(test_python_bindings_DATA
|
||||
test_commodity.py
|
||||
test_numeric.py
|
||||
test_split.py
|
||||
test_transaction.py)
|
||||
test_transaction.py
|
||||
test_query.py)
|
||||
|
||||
set_dist_list(test_python_bindings_DIST CMakeLists.txt ${test_python_bindings_DATA})
|
||||
|
@ -12,6 +12,7 @@ from test_transaction import TestTransaction
|
||||
from test_business import TestBusiness
|
||||
from test_commodity import TestCommodity, TestCommodityNamespace
|
||||
from test_numeric import TestGncNumeric
|
||||
from test_query import TestQuery
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
23
bindings/python/tests/test_query.py
Normal file
23
bindings/python/tests/test_query.py
Normal file
@ -0,0 +1,23 @@
|
||||
from unittest import TestCase, main
|
||||
|
||||
from gnucash import Query
|
||||
from gnucash.gnucash_core_c import GNC_ID_INVOICE
|
||||
|
||||
|
||||
class TestQuery(TestCase):
|
||||
def test_create(self):
|
||||
query = Query()
|
||||
self.assertIsInstance(query, Query)
|
||||
|
||||
def test_search_for(self):
|
||||
query = Query()
|
||||
|
||||
query.search_for(GNC_ID_INVOICE)
|
||||
self.assertEqual(query.get_search_for(), GNC_ID_INVOICE)
|
||||
|
||||
obj_type = 'gncInvoice'
|
||||
query.search_for(obj_type)
|
||||
self.assertEqual(query.get_search_for(), obj_type)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user