Ejemplo n.º 1
0
def test_pypy_versions():
    assert pypy_versions({
        Version.from_string(v)
        for v in
        ['2.7', '3.4', '3.7-dev', '3.8', 'nightly', 'PyPy3', 'Jython']
    }) == {Version.from_string(v)
           for v in ['PyPy3']}
Ejemplo n.º 2
0
def test_version_from_string() -> None:
    assert Version.from_string('3') == Version(major=3)
    assert Version.from_string('3.0') == Version(major=3, minor=0)
    assert Version.from_string('3.6') == Version(major=3, minor=6)
    assert Version.from_string('3.10-dev') == Version('', 3, 10, '-dev')
    assert Version.from_string('PyPy') == Version('PyPy')
    assert Version.from_string('PyPy3') == Version('PyPy', 3)
    assert Version.from_string('PyPy-dev') == Version('PyPy', suffix='-dev')
    assert Version.from_string('PyPy3-dev') == Version('PyPy', 3, -1, '-dev')
    assert Version.from_string('3') != Version.from_string('3.0')
Ejemplo n.º 3
0
def test_version_sorting():
    assert sorted(
        Version.from_string(v) for v in [
            '2.7',
            '3.1',
            '3.6',
            '3.10',
            '3.10-dev',
            'PyPy',
            'PyPy3',
            'nightly',
        ]) == [
            Version.from_string(v) for v in [
                '2.7',
                '3.1',
                '3.6',
                '3.10',
                '3.10-dev',
                'PyPy',
                'PyPy3',
                'nightly',
            ]
        ]
Ejemplo n.º 4
0
def v(versions: List[str]) -> List[Version]:
    return [Version.from_string(v) for v in versions]
Ejemplo n.º 5
0
def test_parse_gh_ver(s, expected):
    assert parse_gh_ver(s) == Version.from_string(expected)
Ejemplo n.º 6
0
def test_tox_env_to_py_version(s, expected):
    expected = expected and Version.from_string(expected)
    assert tox_env_to_py_version(s) == expected
Ejemplo n.º 7
0
def test_version_str_roundtrips(v):
    assert str(Version.from_string(v)) == v
Ejemplo n.º 8
0
def test_expand_pypy(versions, expected):
    assert expand_pypy([Version.from_string(v) for v in versions
                        ]) == [Version.from_string(v) for v in expected]
Ejemplo n.º 9
0
def test_travis_normalize_py_version(s, expected):
    assert travis_normalize_py_version(s) == Version.from_string(expected)
Ejemplo n.º 10
0
def test_appveyor_normalize_py_version(s, expected):
    expected = expected and Version.from_string(expected)
    assert appveyor_normalize_py_version(s) == expected