From 724fefb23e4a6ec7d8bffd766c74d6167580f204 Mon Sep 17 00:00:00 2001 From: Menelaos Date: Tue, 19 Dec 2023 01:37:52 +0200 Subject: [PATCH] Fix old test cases to comply with GH issue number range --- blurb/blurb.py | 8 +++----- blurb/tests/fail/small-gh-number.rst | 4 ++++ blurb/tests/pass/basic.rst | 2 +- blurb/tests/pass/basic.rst.res | 2 +- blurb/tests/pass/case-insensitive.rst | 2 +- blurb/tests/pass/case-insensitive.rst.res | 2 +- blurb/tests/pass/no-break-long-words.rst | 2 +- blurb/tests/pass/no-break-long-words.rst.res | 2 +- blurb/tests/pass/no-break-on-hyphens.rst | 2 +- blurb/tests/pass/no-break-on-hyphens.rst.res | 2 +- 10 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 blurb/tests/fail/small-gh-number.rst diff --git a/blurb/blurb.py b/blurb/blurb.py index f5d60fb..3257a53 100755 --- a/blurb/blurb.py +++ b/blurb/blurb.py @@ -486,6 +486,9 @@ def finish_entry(): # we'll complain about the *first* error # we see in the blurb file, which is a # better user experience. + if key == "gh-issue" and int(value) < 32426: + throw("The gh-issue number should be 32426 or above.") + if key in issue_keys: try: int(value) @@ -959,11 +962,6 @@ def init_tmp_with_template(): assert len(blurb) # if parse_blurb succeeds, we should always have a body if len(blurb) > 1: failure = "Too many entries! Don't specify '..' on a line by itself." - gh_issue_number = blurb[0][0]["gh-issue"] - if not gh_issue_number.isdigit(): - failure = "The gh-issue number must be a number." - if int(gh_issue_number) < 32426: - failure = "The gh-issue number should be 32426 or above." if failure: print() diff --git a/blurb/tests/fail/small-gh-number.rst b/blurb/tests/fail/small-gh-number.rst new file mode 100644 index 0000000..9e702fb --- /dev/null +++ b/blurb/tests/fail/small-gh-number.rst @@ -0,0 +1,4 @@ +.. gh-issue: 100 +.. section: Library + +This is an invalid blurb. GitHub issues should be 32426 or above. \ No newline at end of file diff --git a/blurb/tests/pass/basic.rst b/blurb/tests/pass/basic.rst index 9667423..e6b0b75 100644 --- a/blurb/tests/pass/basic.rst +++ b/blurb/tests/pass/basic.rst @@ -1,5 +1,5 @@ .. date: 2017-05-02 -.. gh-issue: 0 +.. gh-issue: 40000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/basic.rst.res b/blurb/tests/pass/basic.rst.res index 9667423..e6b0b75 100644 --- a/blurb/tests/pass/basic.rst.res +++ b/blurb/tests/pass/basic.rst.res @@ -1,5 +1,5 @@ .. date: 2017-05-02 -.. gh-issue: 0 +.. gh-issue: 40000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/case-insensitive.rst b/blurb/tests/pass/case-insensitive.rst index 8148b68..ca1cbd5 100644 --- a/blurb/tests/pass/case-insensitive.rst +++ b/blurb/tests/pass/case-insensitive.rst @@ -1,5 +1,5 @@ .. date: 2017-05-02 -.. GH-Issue: 0 +.. GH-Issue: 35000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/case-insensitive.rst.res b/blurb/tests/pass/case-insensitive.rst.res index 9667423..4f1aad5 100644 --- a/blurb/tests/pass/case-insensitive.rst.res +++ b/blurb/tests/pass/case-insensitive.rst.res @@ -1,5 +1,5 @@ .. date: 2017-05-02 -.. gh-issue: 0 +.. gh-issue: 35000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/no-break-long-words.rst b/blurb/tests/pass/no-break-long-words.rst index 334f913..10f5d9e 100644 --- a/blurb/tests/pass/no-break-long-words.rst +++ b/blurb/tests/pass/no-break-long-words.rst @@ -1,5 +1,5 @@ .. date: 1234 -.. gh-issue: 0 +.. gh-issue: 35000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/no-break-long-words.rst.res b/blurb/tests/pass/no-break-long-words.rst.res index 334f913..10f5d9e 100644 --- a/blurb/tests/pass/no-break-long-words.rst.res +++ b/blurb/tests/pass/no-break-long-words.rst.res @@ -1,5 +1,5 @@ .. date: 1234 -.. gh-issue: 0 +.. gh-issue: 35000 .. nonce: xyz .. section: Library diff --git a/blurb/tests/pass/no-break-on-hyphens.rst b/blurb/tests/pass/no-break-on-hyphens.rst index 4b46c52..48bd427 100644 --- a/blurb/tests/pass/no-break-on-hyphens.rst +++ b/blurb/tests/pass/no-break-on-hyphens.rst @@ -1,5 +1,5 @@ .. date: 7333 -.. gh-issue: 21121 +.. gh-issue: 41121 .. nonce: ZLsRil .. section: Library diff --git a/blurb/tests/pass/no-break-on-hyphens.rst.res b/blurb/tests/pass/no-break-on-hyphens.rst.res index 0b6e892..cb76b62 100644 --- a/blurb/tests/pass/no-break-on-hyphens.rst.res +++ b/blurb/tests/pass/no-break-on-hyphens.rst.res @@ -1,5 +1,5 @@ .. date: 7333 -.. gh-issue: 21121 +.. gh-issue: 41121 .. nonce: ZLsRil .. section: Library