From 4867be54d61b3b21ed17e020b38a69a3ce01e237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 10 Jun 2024 10:48:42 +0200 Subject: [PATCH] We can have a revision that ends with tilde MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Brunner --- src/debian_inspector/version.py | 2 +- tests/test_version.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debian_inspector/version.py b/src/debian_inspector/version.py index 1ee5a9e..f070b96 100644 --- a/src/debian_inspector/version.py +++ b/src/debian_inspector/version.py @@ -177,7 +177,7 @@ def tuple(self): r'|' # If there is no debian_revision then hyphens are not allowed. # we are adding the extra check that it must end with alphanum - r'[A-Za-z0-9\.\+\~]*[A-Za-z0-9]-[A-Za-z0-9\+\.\~]*[A-Za-z0-9]' + r'[A-Za-z0-9\.\+\~]*[A-Za-z0-9]-[A-Za-z0-9\+\.\~]*[A-Za-z0-9\~]' r')?' r'$').match diff --git a/tests/test_version.py b/tests/test_version.py index 604d5dd..8ee2fbb 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -54,6 +54,9 @@ def test_Version_from_string_tuples(self): assert (0, '0.0', '0') == Version.from_string('0:0.0-0').tuple() assert (0, '0.0', '00') == Version.from_string('0:0.0-00').tuple() + def test_Version_from_string_tilde(self): + assert '0~' == Version.from_string('0.0.0+dfsg-0~').revision + def test_get_non_digit_prefix(self): assert '' == get_non_digit_prefix('') assert '' == get_non_digit_prefix('0')