def test_version_list_with_range_included_in_concrete_version_interpreted_as_range(): # Note: this test only tests whether we can construct a version list of a range # and a version, where the range is contained in the version when it is interpreted # as a range. That is: Version('3.1') interpreted as VersionRange('3.1', '3.1'). # Cleary it *shouldn't* be interpreted that way, but that is how Spack currently # behaves, and this test only ensures that creating a VersionList of this type # does not throw like reported in the linked Github issue. VersionList([Version('3.1'), VersionRange('3.1.1', '3.1.2')])
def test_version_list_with_range_and_concrete_version_is_not_concrete(): v = VersionList([Version('3.1'), VersionRange('3.1.1', '3.1.2')]) assert v.concrete
def test_version_range_nonempty(): assert Version('1.2.9') in VersionRange('1.2.0', '1.2') assert Version('1.1.1') in ver('1.0:1')
def test_empty_version_range_raises(): with pytest.raises(ValueError): assert VersionRange('2', '1.0') with pytest.raises(ValueError): assert ver('2:1.0')
def test_version_range_satisfies_means_nonempty_intersection(): x = VersionRange('3.7.0', '3') y = VersionRange('3.6.0', '3.6.0') assert not x.satisfies(y) assert not y.satisfies(x)