8000 Fix gh-issue- prefix by JelleZijlstra · Pull Request #424 · python/bedevere · GitHub
[go: up one dir, main page]

Skip to content

Fix gh-issue- prefix #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bedevere/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

FILENAME_RE = re.compile(r"""# YYYY-mm-dd or YYYY-mm-dd-HH-MM-SS
\d{4}-\d{2}-\d{2}(?:-\d{2}-\d{2}-\d{2})?\.
(?:bpo|gh)-\d+(?:,\d+)*\. # Issue number(s)
(?:bpo|gh-issue)-\d+(?:,\d+)*\. # Issue number(s)
[A-Za-z0-9_=-]+\. # Nonce (URL-safe base64)
rst # File extension""",
re.VERBOSE)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_news.py
8A26
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ async def post(self, url, *, data):
return self._post_return


GOOD_BASENAME = '2017-06-16-20-32-50.gh-1234.nonce.rst'
GOOD_BASENAME = '2017-06-16-20-32-50.gh-issue-1234.nonce.rst'
BPO_BASENAME = '2017-06-16-20-32-50.bpo-1234.nonce.rst'


class TestFilenameRE:

def test_malformed_basename(self):
assert news.FILENAME_RE.match('2017-06-16.gh-issue-1234.rst') is None
assert news.FILENAME_RE.match('2017-06-16.gh-1234.rst') is None

def test_success(self):
assert news.FILENAME_RE.match(GOOD_BASENAME)
live_result = '2017-08-14-15-13-50.gh-1612262.-x_Oyq.rst'
live_result = '2017-08-14-15-13-50.gh-issue-1612262.-x_Oyq.rst'
assert news.FILENAME_RE.match(live_result)

def test_multiple_issue_numbers(self):
basename = '2018-01-01.gh-1234,5678,9012.nonce.rst'
basename = '2018-01-01.gh-issue-1234,5678,9012.nonce.rst'
assert news.FILENAME_RE.match(basename)

def test_date_only(self):
basename = '2017-08-14.gh-1234.nonce.rst'
basename = '2017-08-14.gh-issue-1234.nonce.rst'
assert news.FILENAME_RE.match(basename)

def test_malformed_basename_bpo(self):
Expand Down
0