Skip to content

Commit

Permalink
Fix strip_release bug
Browse files Browse the repository at this point in the history
If there were more than one sets of brackets, the value was replaced by
an empty string
  • Loading branch information
jdavcs committed Dec 2, 2024
1 parent 4848558 commit 3761174
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion galaxy_release_util/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ def _pr_to_labels(pr: PullRequest) -> List[str]:


def strip_release(message):
return re.sub(r"^\s*\[.*\]\s*", r"", message)
return re.sub(r"^\s*\[[\w,\.,-]*\]\s*", r"", message)
15 changes: 15 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from galaxy_release_util.metadata import strip_release


def test_strip_release():
"""Verify that the first occurance of [*] is stripped out."""
assert strip_release("foo") == "foo"
assert strip_release("[1]foo") == "foo"
assert strip_release("[1.2.3]foo") == "foo"
assert strip_release("[]foo") == "foo"
assert strip_release("[][]foo") == "[]foo"
assert strip_release("foo[]") == "foo[]"
assert strip_release("[]foo[]") == "foo[]"
assert strip_release("foo[bar]") == "foo[bar]"
assert strip_release("foo[]baz") == "foo[]baz"
assert strip_release("foo[bar]baz") == "foo[bar]baz"

0 comments on commit 3761174

Please sign in to comment.