def test_valuelist_version_part_copy(): vp = vpart.ValueListVersionPart('major', 4, [0, 2, 4, 6, 8]) nvp = vp.copy() vp.inc() vp.values.append(9) assert nvp.value == 4 assert nvp.values == [0, 2, 4, 6, 8]
def test_valuelist_version_part_set(): vp = vpart.ValueListVersionPart('major', 0, [0, 2, 4, 6, 8]) vp.set(8) assert vp.value == 8
def test_valuelist_version_part_increase(): vp = vpart.ValueListVersionPart('major', 0, [0, 2, 4, 6, 8]) vp.inc() assert vp.value == 2
def test_valuelist_version_part_init_with_none(): vp = vpart.ValueListVersionPart('major', None, [0, 2, 4, 6, 8]) assert vp.value == 0
def test_valuelist_version_part_init_with_not_allowed_value(): with pytest.raises(ValueError): vpart.ValueListVersionPart('major', 1, [0, 2, 4, 6, 8])
def test_valuelist_version_part_set_with_non_numerical_values(): vp = vpart.ValueListVersionPart('major', 0, [0, 'alpha', 'beta', 'rc1', 'rc2', 1]) vp.set('rc1') assert vp.value == 'rc1'