self._msg_p, capi.lib.NOTMUCH_MESSAGE_FLAG_EXCLUDED)
return bool(ret)
+ @property
+ def matched(self):
+ """Indicates whether this message was matched by the query.
+
+ When a thread is created from a search, some of the
+ messages may not match the original query. This property
+ is set to *True* for those that do match.
+
+ :raises ObjectDestroyedError: if used after destroyed.
+ """
+ ret = capi.lib.notmuch_message_get_flag(
+ self._msg_p, capi.lib.NOTMUCH_MESSAGE_FLAG_MATCH)
+ return bool(ret)
+
@property
def date(self):
"""The message date as an integer.
def test_ghost_no(self, msg):
assert not msg.ghost
+ def test_matched_no(self,msg):
+ assert not msg.matched
+
def test_date(self, msg):
# XXX Someone seems to treat things as local time instead of
# UTC or the other way around.
def test_matched(thread):
assert thread.matched == 1
+def test_matched_iter(thread):
+ count = 0
+ msgs = list(iter(thread))
+ for msg in msgs:
+ if msg.matched:
+ count += 1
+ assert count == thread.matched
def test_authors_type(thread):
assert isinstance(thread.authors, notmuch2.BinString)