gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu Sep 20 13:56:48 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/77fb01db (commit)
	 via  https://github.com/Gnucash/gnucash/commit/54cb3358 (commit)
	from  https://github.com/Gnucash/gnucash/commit/2d565215 (commit)



commit 77fb01db82daef270fe0df81859d30cc7df10e8c
Merge: 2d56521 54cb335
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 20 10:56:01 2018 -0700

    Merge branch Christoph Holterman's 'python-query-test' into maint


commit 54cb3358ce0fd7f373684fcd64b4db7aba41a443
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date:   Thu Sep 20 18:39:05 2018 +0200

    add basic test for python query
    
    add test for creating query object and setting search_for
    related to Bug 796137 and fix in commit 1a7c5b9a32df1d0ccd7e739a70b3d0f38e4dda36

diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt
index 2c45340..28b385e 100644
--- a/bindings/python/tests/CMakeLists.txt
+++ b/bindings/python/tests/CMakeLists.txt
@@ -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})
diff --git a/bindings/python/tests/runTests.py.in b/bindings/python/tests/runTests.py.in
index 38c0d8d..c82fe97 100755
--- a/bindings/python/tests/runTests.py.in
+++ b/bindings/python/tests/runTests.py.in
@@ -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()
diff --git a/bindings/python/tests/test_query.py b/bindings/python/tests/test_query.py
new file mode 100644
index 0000000..c5478e5
--- /dev/null
+++ b/bindings/python/tests/test_query.py
@@ -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()



Summary of changes:
 bindings/python/tests/CMakeLists.txt |  3 ++-
 bindings/python/tests/runTests.py.in |  1 +
 bindings/python/tests/test_query.py  | 23 +++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 bindings/python/tests/test_query.py



More information about the gnucash-changes mailing list