示例#1
0
def test_ver_class():
    v = ver.Version(1, 2, 3)
    assert str(v) == '1.2.3'
    v = ver.Version(1, 2, 3, 'beta', 1)
    assert str(v) == '1.2.3b1'
    v = ver.Version(1, 2, 3, 'development')
    assert str(v) == '1.2.3dev'
    pytest.raises(ValueError, ver.Version, 1, 2, 3, 'howdy')
示例#2
0
def test_ver_class():
    v = ver.Version(1, 2, 3)
    assert str(v) == '1.2.3'
    seq = [1, 2, 3]
    for i, n in enumerate(v):
        print("i:", i, 'n:', n)
        assert n == seq[i]
    v = ver.Version(1, 2, 3, 'beta', 1)
    assert str(v) == '1.2.3.b1'
    v = ver.Version(1, 2, 3, 'beta', 2, 'test')
    assert str(v) == '1.2.3.b2+test'
    v = ver.Version(1, 2, 3, 'beta', label='test')
    assert str(v) == '1.2.3.b+test'
    v = ver.Version(1, 2, 3, 'development')
    assert str(v) == '1.2.3.dev'
    pytest.raises(ValueError, ver.Version, 1, 2, 3, 'howdy')
示例#3
0
def test_bump_version():
    v = ver.Version(1, 2, 3)
    assert tuple(v) == (1, 2, 3)
    v.micro += 1
    assert tuple(v) == (1, 2, 4)