]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python-cffi/tests/test_database.py
Make messages returned by Thread objects owned
[notmuch] / bindings / python-cffi / tests / test_database.py
index e3a8344d8cded01e3a0ee3895faaa9173a816745..55069b5e35df85bb0739a1a0d865302c6693af32 100644 (file)
@@ -324,3 +324,14 @@ class TestQuery:
         threads = db.threads('*')
         thread = next(threads)
         assert isinstance(thread, notmuch2.Thread)
+
+    def test_use_threaded_message_twice(self, db):
+        thread = next(db.threads('*'))
+        for msg in thread.toplevel():
+            assert isinstance(msg, notmuch2.Message)
+            assert msg.alive
+            del msg
+        for msg in thread:
+            assert isinstance(msg, notmuch2.Message)
+            assert msg.alive
+            del msg