This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new 3ef3db84 Fix verb conjugation in the vote resolution email default body
3ef3db84 is described below

commit 3ef3db8445f2b93bfcebd1bf8b7bd58587dbf67b
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Mar 25 14:45:03 2026 +0000

    Fix verb conjugation in the vote resolution email default body
---
 atr/tabulate.py             | 12 +++++++++++-
 tests/unit/test_tabulate.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/atr/tabulate.py b/atr/tabulate.py
index 132a0291..b21b07f0 100644
--- a/atr/tabulate.py
+++ b/atr/tabulate.py
@@ -390,7 +390,12 @@ def _vote_resolution_body_votes(
     binding_yes = summary["binding_votes_yes"]
     binding_no = summary["binding_votes_no"]
     binding_abstain = summary["binding_votes_abstain"]
-    yield f"Of these binding votes, {binding_yes} were +1, {binding_no} were 
-1, and {binding_abstain} were 0."
+    binding_vote_counts = [
+        _vote_resolution_count(binding_yes, "+1"),
+        _vote_resolution_count(binding_no, "-1"),
+        _vote_resolution_count(binding_abstain, "0"),
+    ]
+    yield f"Of these binding votes, {', '.join(binding_vote_counts[:2])}, and 
{binding_vote_counts[2]}."
     yield ""
 
     yield from _vote_resolution_votes(tabulated_votes, 
{models.tabulate.VoteStatus.COMMITTER})
@@ -399,6 +404,11 @@ def _vote_resolution_body_votes(
     )
 
 
+def _vote_resolution_count(count: int, symbol: str) -> str:
+    were_word = "was" if (count == 1) else "were"
+    return f"{count} {were_word} {symbol}"
+
+
 def _vote_resolution_votes(
     tabulated_votes: dict[str, models.tabulate.VoteEmail], statuses: 
set[models.tabulate.VoteStatus]
 ) -> Generator[str]:
diff --git a/tests/unit/test_tabulate.py b/tests/unit/test_tabulate.py
new file mode 100644
index 00000000..731cfa5a
--- /dev/null
+++ b/tests/unit/test_tabulate.py
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import atr.tabulate as tabulate
+
+
+def test_vote_resolution_body_votes_formats_plural_binding_summary() -> None:
+    summary = {
+        "binding_votes": 9,
+        "binding_votes_yes": 8,
+        "binding_votes_no": 0,
+        "binding_votes_abstain": 1,
+    }
+
+    body_lines = list(tabulate._vote_resolution_body_votes({}, summary))
+
+    assert body_lines[2] == "Of these binding votes, 8 were +1, 0 were -1, and 
1 was 0."
+
+
+def test_vote_resolution_body_votes_formats_singular_binding_summary() -> None:
+    summary = {
+        "binding_votes": 9,
+        "binding_votes_yes": 8,
+        "binding_votes_no": 1,
+        "binding_votes_abstain": 0,
+    }
+
+    body_lines = list(tabulate._vote_resolution_body_votes({}, summary))
+
+    assert body_lines[2] == "Of these binding votes, 8 were +1, 1 was -1, and 
0 were 0."


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to