unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [Patch v2 2/5] test: add python tests for query.count_{messages,threads}
Date: Tue, 30 Dec 2014 21:29:37 +0100	[thread overview]
Message-ID: <1419971380-10307-3-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1419971380-10307-1-git-send-email-david@tethera.net>

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

  parent reply	other threads:[~2014-12-30 20:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30 20:29 update count API round 2 David Bremner
2014-12-30 20:29 ` [Patch v2 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
2014-12-30 20:29 ` David Bremner [this message]
2014-12-30 20:29 ` [Patch v2 3/5] test: port existing python tests to ruby David Bremner
2014-12-30 20:29 ` [Patch v2 4/5] bindings/ruby: gitignore *.o David Bremner
2014-12-30 20:29 ` [Patch v2 5/5] lib: add status return to notmuch_query_count_{message,threads} David Bremner
2015-03-07  8:43   ` update count API, round 3 David Bremner
2015-03-07  8:43     ` [PATCH 1/4] lib: add versions of notmuch_query_count_{message,threads} with status return David Bremner
2015-03-07 13:57       ` [PATCH 1/4] lib: add versions of notmuch_query_count_{message, threads} " Jani Nikula
2015-03-07  8:43     ` [PATCH 2/4] cli: update to use new count API David Bremner
2015-03-07 14:00       ` Jani Nikula
2015-03-07  8:43     ` [PATCH 3/4] ruby: update bindings for " David Bremner
2015-03-07  8:43     ` [PATCH 4/4] python: " David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419971380-10307-3-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).