[Patch v2 2/5] test: add python tests for query.count_{messages,threads}

Subject: [Patch v2 2/5] test: add python tests for query.count_{messages,threads}

Date: Tue, 30 Dec 2014 21:29:37 +0100

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


These are more or less cargo culted from the existing python tests. In
particular they compare against the results of doing an analogous
query using the CLI.
---
 test/T390-python.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/T390-python.sh b/test/T390-python.sh
index 3f03a2e..ddbf164 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -36,4 +36,24 @@ print db.find_message_by_filename("i-dont-exist")
 EOF
 test_expect_equal "$(cat OUTPUT)" "None"
 
+test_begin_subtest "count messages"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'tag:inbox')
+print q_new.count_messages()
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count threads"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'tag:inbox')
+print q_new.count_threads()
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
2.1.3


Thread: