def test_version_comparison(version_a, version_b, expected): version_a = semanticversioning.Version(version_a) assert (version_a < version_b) is expected["lt"] assert (version_a <= version_b) is expected["lte"] assert (version_a == version_b) is expected["eq"] assert (version_a != version_b) is expected["neq"] assert (version_a > version_b) is expected["gt"] assert (version_a >= version_b) is expected["gte"] version_b = semanticversioning.Version(version_b) assert (version_a < version_b) is expected["lt"] assert (version_a <= version_b) is expected["lte"] assert (version_a == version_b) is expected["eq"] assert (version_a != version_b) is expected["neq"] assert (version_a > version_b) is expected["gt"] assert (version_a >= version_b) is expected["gte"]
def test_version_from_integer(version, expected): version = semanticversioning.Version(version) assert version.major == expected["major"] assert version.minor == expected["minor"] assert version.patch == expected["patch"]
def test_version_bump(): version = semanticversioning.Version("1.2.3") assert version.bump_major() == "2.0.0" assert version.bump_minor() == "1.3.0" assert version.bump_patch() == "1.2.4" assert version.bump_major().bump_minor().bump_patch() == "2.1.1"