Esempio n. 1
0
def test_equal_prefix():
    assert repr(semver.create_semver_matcher("=1.2.3")) == "==1.2.3"
    assert repr(semver.create_semver_matcher("=1.2")) == "==1.2.0"
    assert repr(semver.create_semver_matcher("  =1")) == "==1.0.0"
    assert semver.create_semver_matcher("=1.2.3").match(
        semver.str_to_version("1.2.3"))
    assert (semver.create_semver_matcher("=1.2.3").match(
        semver.str_to_version("1.2.4")) == False)
    assert (semver.create_semver_matcher("=1.2.3").match(
        semver.str_to_version("1.2.2")) == False)
Esempio n. 2
0
def test_largerthan_equal():
    assert repr(semver.create_semver_matcher(">=   1.2.3")) == ">=   1.2.3"
    assert repr(semver.create_semver_matcher("  >=  1")) == ">=  1.0.0"
    assert semver.create_semver_matcher(">=1").match(
        semver.str_to_version("1.0.0"))
    assert semver.create_semver_matcher(">=0").match(
        semver.str_to_version("0.0.1"))
    assert semver.create_semver_matcher(">=1.2.3").match(
        semver.str_to_version("1.2.3"))
    assert (semver.create_semver_matcher(">=1.2.3").match(
        semver.str_to_version("1.2.2")) == False)
Esempio n. 3
0
def test_less_than_prefix():
    assert repr(semver.create_semver_matcher("<1.2.3")) == "<1.2.3"
    assert repr(semver.create_semver_matcher("<1")) == "<1.0.0"
    assert repr(semver.create_semver_matcher("<0.2.3")) == "<0.2.3"

    assert semver.create_semver_matcher("<2.0.3").match(
        semver.str_to_version("2.0.2"))
    assert semver.create_semver_matcher("<2").match(
        semver.str_to_version("0.0.1"))
    assert semver.create_semver_matcher("<2.0.3").match(
        semver.str_to_version("0.2.3"))
    assert (semver.create_semver_matcher("<0.2.4").match(
        semver.str_to_version("0.2.4")) == False)
Esempio n. 4
0
def test_match_particular_version_expected_false(test_input, expected):
    assert (semver.create_semver_matcher(test_input).match(
        semver.str_to_version(expected)) == False)
Esempio n. 5
0
def test_str_to_version(test_input, expected):
    assert semver.str_to_version(test_input) == expected