예제 #1
0
def test_minor_resets_dev():
    v = cv(12, 1, 11, '')
    assert 'dev' in v
    res = bump_version(v, 'minor').split(".")
    assert 'dev' not in res

    v = cv(12, 1, 15, 12)
    assert 'dev' in v
    res = bump_version(v, 'minor')
    assert 'dev' not in res

    _, _, p = res.split('.')
    assert int(p) == 0
예제 #2
0
def test_patch_resets_dev():
    p = 1
    gold_p = 2
    v = cv(12, 1, p, '')
    assert 'dev' in v
    res = bump_version(v, 'patch').split(".")
    assert 'dev' not in res

    v = cv(12, 1, p, 12)
    assert 'dev' in v
    res = bump_version(v, 'patch')
    assert 'dev' not in res

    _, _, x = res.split('.')
    assert int(x) == gold_p
예제 #3
0
def test_patch_ignores_minor():
    gold_m = 1
    v = cv(13, gold_m, 11)
    _, x, _ = bump_version(v, 'patch').split(".")
    assert int(x) == gold_m
예제 #4
0
def test_major_is_updated():
    M = 1
    gold_M = 2
    v = cv(M, 12, 3)
    m, _, _ = bump_version(v, 'major').split(".")
    assert int(m) == gold_M
예제 #5
0
def test_patch_ignores_major():
    gold_M = 1
    v = cv(gold_M, 13, 11)
    x, _, _ = bump_version(v, 'patch').split(".")
    assert int(x) == gold_M
예제 #6
0
def test_patch_is_updated():
    p = 14
    gold_p = 15
    v = cv(11, 13, p)
    _, _, x = bump_version(v, 'patch').split(".")
    assert int(x) == gold_p
예제 #7
0
def test_minor_resets_patch():
    gold_p = 0
    v = cv(12, 15, 16)
    _, _, x = bump_version(v, 'minor').split('.')
    assert int(x) == gold_p
예제 #8
0
def test_minor_is_updated():
    m = 14
    gold_m = 15
    v = cv(12, m, 13)
    _, x, _ = bump_version(v, 'minor').split('.')
    assert int(x) == gold_m
예제 #9
0
def test_minor_ignores_major():
    M = 12
    gold_M = M
    v = cv(M, 16, 12)
    x, _, _ = bump_version(v, 'minor').split('.')
    assert int(x) == gold_M
예제 #10
0
def test_major_resets_minor():
    gold_m = 0
    m = 15
    v = cv(12, m, 3)
    _, m, _ = bump_version(v, 'major').split(".")
    assert int(m) == gold_m
예제 #11
0
def test_major_resets_patch():
    gold_p = 0
    p = 15
    v = cv(12, 1, p)
    _, _, p = bump_version(v, 'major').split(".")
    assert int(p) == gold_p
예제 #12
0
def test_dev_ignores_patch():
    gold_p = 1
    v = cv(12, 13, gold_p, 13)
    _, _, x = bump_version(v, 'dev').split(".")
    x, _ = x.split('dev')
    assert int(x) == gold_p
예제 #13
0
def test_dev_ignores_minor():
    gold_m = 1
    v = cv(1, gold_m, 13, 11)
    _, x, _ = bump_version(v, 'dev').split(".")
    assert int(x) == gold_m
예제 #14
0
def test_dev_is_updated_from_empty():
    d = ''
    gold_d = 1
    v = cv(1, 1, 1, d)
    _, x = bump_version(v, 'dev').split('dev')
    assert int(x) == gold_d
예제 #15
0
def test_dev_is_updated_from_number():
    d = 12
    gold_d = 13
    v = cv(1, 1, 1, d)
    _, x = bump_version(v, 'dev').split('dev')
    assert int(x) == gold_d
예제 #16
0
def test_dev_is_updated_from_none():
    d = None
    v = cv(1, 1, 1, d)
    res = bump_version(v, 'dev')
    assert res.endswith('dev')