From 60f10af6a0df9dd8d8b433536871caca00768e6e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:41:57 +0200 Subject: [PATCH] Improve error wording Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> --- src/blurb/blurb.py | 4 ++-- tests/test_blurb.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/blurb/blurb.py b/src/blurb/blurb.py index bb09b71..25c3b87 100755 --- a/src/blurb/blurb.py +++ b/src/blurb/blurb.py @@ -486,10 +486,10 @@ def finish_entry(): try: int(value) except (TypeError, ValueError): - throw(f"Invalid {issue_keys[key]} issue number! ({value!r})") + throw(f"Invalid {issue_keys[key]} number: {value!r}") if key == "gh-issue" and int(value) < lowest_possible_gh_issue_number: - throw(f"The gh-issue number must be {lowest_possible_gh_issue_number} or above, not a PR number.") + throw(f"Invalid gh-issue number: {value!r} (must be >= {lowest_possible_gh_issue_number})") if key == "section": if no_changes: diff --git a/tests/test_blurb.py b/tests/test_blurb.py index 3570e79..cd8f20a 100644 --- a/tests/test_blurb.py +++ b/tests/test_blurb.py @@ -217,15 +217,15 @@ def test_parse(): ), ( ".. gh-issue: 1\n.. section: IDLE\nHello world!", - r"The gh-issue number must be 32426 or above, not a PR number", + r"Invalid gh-issue number: '1' \(must be >= 32426\)", ), ( ".. bpo: one-two\n.. section: IDLE\nHello world!", - r"Invalid bpo issue number! \('one-two'\)", + r"Invalid bpo number: 'one-two'", ), ( ".. gh-issue: one-two\n.. section: IDLE\nHello world!", - r"Invalid GitHub issue number! \('one-two'\)", + r"Invalid GitHub number: 'one-two'", ), ( ".. gh-issue: 123456\n.. section: Funky Kong\nHello world!",