From: David Bremner Date: Sat, 15 Feb 2025 19:22:53 +0000 (-0400) Subject: test/message-property: convert python tests from legacy bindings X-Git-Tag: archive/debian/0.39_rc0-1~6 X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=58ea60c2e49fb7881046829141a7a795d1a3ffca;p=notmuch test/message-property: convert python tests from legacy bindings One test is deleted since that method is not provided by the new bindings. Similar things can be done by accessing the PropertiesMap returned by properties. This change is a prelude to removing the legacy bindings from the build. --- diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh index a7cbe048..04a5d488 100755 --- a/test/T610-message-property.sh +++ b/test/T610-message-property.sh @@ -299,26 +299,12 @@ id:4EFC743A.3060609@april.org EOF test_expect_equal_file EXPECTED OUTPUT -test_begin_subtest "msg.get_property (python)" +test_begin_subtest "msg.properties (python)" test_python <<'EOF' -import notmuch -db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) -msg = db.find_message("4EFC743A.3060609@april.org") -print("testkey1 = {0}".format(msg.get_property("testkey1"))) -print("testkey3 = {0}".format(msg.get_property("testkey3"))) -EOF -cat <<'EOF' > EXPECTED -testkey1 = alice -testkey3 = alice3 -EOF -test_expect_equal_file EXPECTED OUTPUT - -test_begin_subtest "msg.get_properties (python)" -test_python <<'EOF' -import notmuch -db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY) -msg = db.find_message("4EFC743A.3060609@april.org") -for (key,val) in msg.get_properties("testkey1"): +import notmuch2 +db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY) +msg = db.find("4EFC743A.3060609@april.org") +for (key,val) in msg.properties.getall("testkey1"): print("{0} = {1}".format(key,val)) EOF cat <<'EOF' > EXPECTED @@ -328,12 +314,12 @@ testkey1 = testvalue2 EOF test_expect_equal_file EXPECTED OUTPUT -test_begin_subtest "msg.get_properties (python, prefix)" +test_begin_subtest "msg.properties (python, prefix)" test_python <<'EOF' -import notmuch -db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY) -msg = db.find_message("4EFC743A.3060609@april.org") -for (key,val) in msg.get_properties("testkey"): +import notmuch2 +db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY) +msg = db.find("4EFC743A.3060609@april.org") +for (key,val) in msg.properties.getall("testkey"): print("{0} = {1}".format(key,val)) EOF cat <<'EOF' > EXPECTED @@ -346,12 +332,12 @@ testkey3 = testvalue3 EOF test_expect_equal_file EXPECTED OUTPUT -test_begin_subtest "msg.get_properties (python, exact)" +test_begin_subtest "msg.properties (python, exact)" test_python <<'EOF' -import notmuch -db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY) -msg = db.find_message("4EFC743A.3060609@april.org") -for (key,val) in msg.get_properties("testkey",True): +import notmuch2 +db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY) +msg = db.find("4EFC743A.3060609@april.org") +for (key,val) in msg.properties("testkey",True): print("{0} = {1}".format(key,val)) EOF test_expect_equal_file /dev/null OUTPUT