Merge pull request #143 from Carreau/parse-alpha

Parse alpha, beta and rc versions strings.
This commit is contained in:
Batuhan Taskaya
2020-07-01 11:14:40 +03:00
committed by GitHub
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ def version_info():
def _parse_version(version): def _parse_version(version):
match = re.match(r'(\d+)(?:\.(\d{1,2})(?:\.\d+)?)?$', version) match = re.match(r'(\d+)(?:\.(\d{1,2})(?:\.\d+)?)?((a|b|rc)\d)?$', version)
if match is None: if match is None:
raise ValueError('The given version is not in the right format. ' raise ValueError('The given version is not in the right format. '
'Use something like "3.8" or "3".') 'Use something like "3.8" or "3".')
+3
View File
@@ -89,6 +89,9 @@ def test_bytes_to_unicode_failing_encoding(code, errors):
('3.6', (3, 6)), ('3.6', (3, 6)),
('3.6.10', (3, 6)), ('3.6.10', (3, 6)),
('3.10', (3, 10)), ('3.10', (3, 10)),
('3.10a9', (3, 10)),
('3.10b9', (3, 10)),
('3.10rc9', (3, 10)),
] ]
) )
def test_parse_version_string(version_str, version): def test_parse_version_string(version_str, version):