Correctly parse 2-digit minor versions (py3.10)

This commit is contained in:
Batuhan Taskaya
2020-05-21 15:46:14 +03:00
committed by Dave Halter
parent caadf3bf4c
commit 34b8b7dd79
3 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,11 @@
from codecs import BOM_UTF8
from parso.utils import split_lines, python_bytes_to_unicode
from parso.utils import (
split_lines,
parse_version_string,
python_bytes_to_unicode,
)
import parso
import pytest
@@ -77,3 +82,18 @@ def test_bytes_to_unicode_failing_encoding(code, errors):
python_bytes_to_unicode(code, errors=errors)
else:
python_bytes_to_unicode(code, errors=errors)
@pytest.mark.parametrize(
('version_str', 'version'), [
('3', (3,)),
('3.6', (3, 6)),
('3.6.10', (3, 6)),
('3.10', (3, 10)),
]
)
def test_parse_version_string(version_str, version):
parsed_version = parse_version_string(version_str)
if len(version) == 1:
assert parsed_version[0] == version[0]
else:
assert parsed_version == version