mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 12:54:29 +08:00
Correctly parse 2-digit minor versions (py3.10)
This commit is contained in:
committed by
Dave Halter
parent
caadf3bf4c
commit
34b8b7dd79
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user