Пример #1
0
def test_node_version_fallback_upstream():
    pv = NodeVersionFallback('1.2.3')
    assert pv.upstream is pv
Пример #2
0
def test_node_version_fallback_public():
    assert NodeVersionFallback('1.2.3.dev2').parts == (1, 2, 3, 'dev', 2)
    assert NodeVersionFallback('1.2.3.rc3').parts == (1, 2, 3, 'rc', 3)
    assert NodeVersionFallback('1.2.3').parts == (1, 2, 3, None, None)
Пример #3
0
def test_node_version_fallback_comparison_operators():
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.2') < NodeVersionFallback('1.2.3')
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.3') > NodeVersionFallback('1.2.2')
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.2') <= NodeVersionFallback('1.2.3')
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.3') <= NodeVersionFallback('1.2.3')
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.3') >= NodeVersionFallback('1.2.2')
    with pytest.raises(TypeError):
        assert NodeVersionFallback('1.2.2') >= NodeVersionFallback('1.2.2')

    assert NodeVersionFallback('1.2.2') == NodeVersionFallback('1.2.2')
    assert NodeVersionFallback('1.2.2') != NodeVersionFallback('1.2.3')
Пример #4
0
def test_node_version_fallback_str():
    version = '1.2.3'
    assert str(NodeVersionFallback(version)) == version
Пример #5
0
def test_sem_ver_base_api():
    assert NodeVersionFallback('1.2.3').major == 1
    assert NodeVersionFallback('1.2.3').minor == 2
    assert NodeVersionFallback('1.2.3').patch == 3
Пример #6
0
def test_node_version_fallback_init_valid(version):
    NodeVersionFallback(version)
Пример #7
0
def test_node_version_fallback_init_invalid(version):
    with pytest.raises(InvalidVersionError):
        NodeVersionFallback(version)
Пример #8
0
def test_node_version_fallback_repr():
    version = '1.2.3'
    assert (repr(NodeVersionFallback(version)) == "{}(version='{}')".format(
        NodeVersionFallback.__name__, version))
Пример #9
0
def test_node_version_fallback_base_api(version):
    v = NodeVersionFallback(version)
    assert v.full == version
    assert v.public == version
    assert v.release_parts == v.parts[:3]
    assert v.release == '.'.join(map(str, v.release_parts))