Exemplo n.º 1
0
def test_parse(
    version,
    expected_major,
    expected_minor,
    expected_patch,
    expected_prerelease,
    expected_build_metadata,
):
    semver = parse_semver(version)

    assert expected_major == semver.major
    assert expected_minor == semver.minor
    assert expected_patch == semver.patch
    assert expected_prerelease == semver.pre_release
    assert expected_build_metadata == semver.build_metadata

    assert version == str(semver)
Exemplo n.º 2
0
def test_parse_invalid():
    with pytest.raises(ValueError):
        parse_semver("blerg")
Exemplo n.º 3
0
    def test_transform_non_changing_non_numerical_part(self, part):
        version = parse_semver(self._raw_version)
        value = getattr(version, part)

        with pytest.raises(ValueError):
            self._transform(part, version, value)
Exemplo n.º 4
0
 def test_transform_non_increasing_numerical_part(self, value):
     with pytest.raises(ValueError):
         self._transform("major", parse_semver("2.0.0"), value)
Exemplo n.º 5
0
 def test_transform_invalid_value_for_numerical_part(self):
     with pytest.raises(ValueError):
         self._transform("major", parse_semver("2.0.0"), "a")
Exemplo n.º 6
0
 def test_transform_invalid_part(self):
     with pytest.raises(ValueError):
         self._transform("dummy", parse_semver("2.0.0"), 1)
Exemplo n.º 7
0
 def test_transform(self, part, value, expected_version):
     new_semver = self._transform(part, parse_semver(self._raw_version),
                                  value)
     assert expected_version == str(new_semver)
Exemplo n.º 8
0
 def test_transform_invalid_parts(self, part):
     with pytest.raises(ValueError):
         self._transform(part, parse_semver(self._raw_version))