mirror of
https://github.com/lilydjwg/nvchecker
synced 2025-01-13 01:30:54 +00:00
Merge remote-tracking branch 'origin/pr/155' into master
This commit is contained in:
commit
494c67beb0
@ -280,7 +280,7 @@ def substitute_version(
|
||||
from_pattern = conf.get('from_pattern')
|
||||
if from_pattern:
|
||||
to_pattern = conf.get('to_pattern')
|
||||
if not to_pattern:
|
||||
if to_pattern is None:
|
||||
raise ValueError("from_pattern exists but to_pattern doesn't")
|
||||
|
||||
return re.sub(from_pattern, to_pattern, version)
|
||||
|
@ -34,6 +34,14 @@ async def test_substitute_regex_missing_ok(get_version):
|
||||
"to_pattern": r"r\1.\2",
|
||||
}) == "r15"
|
||||
|
||||
async def test_substitute_regex_empty_to_pattern(get_version):
|
||||
assert await get_version("example", {
|
||||
"source": "manual",
|
||||
"manual": "15-debian",
|
||||
"from_pattern": r"-\w+$",
|
||||
"to_pattern": r"",
|
||||
}) == "15"
|
||||
|
||||
async def test_substitute_prefix_has_higher_priority(get_version):
|
||||
assert await get_version("example", {
|
||||
"source": "manual",
|
||||
|
Loading…
Reference in New Issue
Block a user