Example #1
0
 def test_precision_greater_than_version(self):
     """
     When precision is greater than the precision of the version, an error
     should be raised.
     """
     with ExpectedException(
             ValueError,
             r'The minimum precision \(4\) is greater than the precision '
             r"of version '3\.5\.3' \(3\)"):
         generate_semver_versions('3.5.3', precision=4)
Example #2
0
 def test_does_generate_zero_if_only_zero(self):
     """
     When the version '0' is passed, that version should be returned in a
     list.
     """
     versions = generate_semver_versions('0')
     assert_that(versions, Equals(['0']))
Example #3
0
 def test_does_not_generate_zero(self):
     """
     When a version is passed with a major version of 0, the version '0'
     should not be returned in the list of versions.
     """
     versions = generate_semver_versions('0.6.11')
     assert_that(versions, Equals(['0.6.11', '0.6']))
Example #4
0
 def test_precision_equal_to_version(self):
     """
     When precision is equal to the precision of the version, the generated
     versions should be just the version itself.
     """
     versions = generate_semver_versions('3.5.3', precision=3)
     assert_that(versions, Equals(['3.5.3']))
Example #5
0
 def test_precision_less_than_version(self):
     """
     When precision is less than the precision of the version, semantic
     versions should be generated up to the specified precision.
     """
     versions = generate_semver_versions('3.5.3', precision=2)
     assert_that(versions, Equals(['3.5.3', '3.5']))
Example #6
0
 def test_one_version_part(self):
     """
     When a version with a single part is passed, that version should be
     returned in a list.
     """
     versions = generate_semver_versions('foo')
     assert_that(versions, Equals(['foo']))
Example #7
0
 def test_extended_version(self):
     """
     When a version is passed with extra information separated by '-',
     version strings should be returned with decreasing levels of precision.
     """
     versions = generate_semver_versions('5.5.0-alpha')
     assert_that(versions, Equals(['5.5.0-alpha', '5.5.0', '5.5', '5']))
Example #8
0
 def test_standard_version(self):
     """
     When a standard 3-part semantic version is passed, 3 version strings
     should be returned with decreasing levels of precision.
     """
     versions = generate_semver_versions('5.4.1')
     assert_that(versions, Equals(['5.4.1', '5.4', '5']))
Example #9
0
 def test_zero_true(self):
     """
     When a version is passed with a major version of 0, and the zero
     parameter is True, the version '0' should be returned in the list of
     versions.
     """
     versions = generate_semver_versions('0.6.11', zero=True)
     assert_that(versions, Equals(['0.6.11', '0.6', '0']))