Skip to content

Commit

Permalink
Merge pull request #143 from Carreau/parse-alpha
Browse files Browse the repository at this point in the history
Parse alpha, beta and rc versions strings.
  • Loading branch information
isidentical authored Jul 1, 2020
2 parents c88a267 + 40e78ff commit d42c0f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def version_info():


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:
raise ValueError('The given version is not in the right format. '
'Use something like "3.8" or "3".')
Expand Down
3 changes: 3 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def test_bytes_to_unicode_failing_encoding(code, errors):
('3.6', (3, 6)),
('3.6.10', (3, 6)),
('3.10', (3, 10)),
('3.10a9', (3, 10)),
('3.10b9', (3, 10)),
('3.10rc9', (3, 10)),
]
)
def test_parse_version_string(version_str, version):
Expand Down

0 comments on commit d42c0f1

Please sign in to comment.