fix(utils): correct humanize_list formatting for two-item lists
Metadata
Current evaluation
Merged: commit c7a1d2b "fix(utils): correct humanize_list for two-item lists (#425)" makes two-item lists render as "a and b" (no serial comma), keeps serial commas for longer lists, and adds unit tests.
Resolution: closed resolved
Reason: PR canonical/craft-cli#425 was approved and merged as commit c7a1d2b after a CLA check refresh and a formatting fix requested by mr-cal. It closes issue #414, and craft_cli/utils.py now has explicit single-item and two-item branches with tests in tests/unit/test_utils.py.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Fix incorrect formatting of two-item lists in humanize_list.
Current behaviour:
humanize_list(["a", "b"]) -> "a, and b"
Expected behaviour:
"a and b"
This patch:
- handles one-item and two-item lists explicitly
- preserves the serial comma behaviour for longer lists
- adds unit tests for the function
Fixes #414
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged: commit c7a1d2b "fix(utils): correct humanize_list for two-item lists (#425)" makes two-item lists render as "a and b" (no serial comma), keeps serial commas for longer lists, and adds unit tests. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/craft-cli#425 (c7a1d2b), fixing two-item humanize_list output to "a and b" while retaining serial commas for longer lists; unit tests were added and CI passed. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix correcting humanize_list formatting for two-item lists, changing output from a, and b to a and b while preserving serial commas for longer lists. Added unit tests, passed all CI checks, and resolved minor formatting adjustments before merge. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/craft-cli#414
(confidence 98%)
Issue titled "humanize_list does not properly handle two-item lists", closed by this PR; its summary cites commit c7a1d2b.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #414 `humanize_list` does not properly handle two-item lists. | craft-cli | closed | Fixed in canonical/craft-cli#425 (c7a1d2b): two-item lists now render as "a and b", while longer lists retain serial commas. | |
| #412 `humanize_list` output is incorrect when list contains only one item | craft-cli | closed | Fixed in merged PR #425 (commit c7a1d2b). humanize_list now returns the sole item for 1-element lists (plus 'a and b' for two items), with new unit tests in tests/unit/test_utils.py. |