def to_right_url(self): """ Process the conversion to the right URL. """ if Version.is_local_dev(): return self.data_to_convert.replace("master", "dev") return self.data_to_convert.replace("dev", "master")
def test_is_not_local_dev(self): """ Tests if the local version is the not the dev one. """ expected = False actual = Version.is_local_dev() self.assertEqual(expected, actual)
def test_literal_comparison(self): """ Tests the literal comparison. """ given = "1.0.0.dev (Hello, World!)" expected = True actual = Version.literally_compare(given, given) self.assertEqual(expected, actual)
def test_split_version(self): """ Tests the case that we want to split the version. """ given = "1.0.0.dev (Hello, World!)" expected = ["1", "0", "0"] actual = Version.split_versions(given) self.assertEqual(expected, actual)
def test_compare_local_version_is_newer(self): """ Tests the comparison for the case that the local version is older. """ given = "1.15.0.dev (Hello, World)" expected = False actual = Version.compare(given) self.assertEqual(expected, actual)
def test_literal_comparison_different(self): """ Tests the litaral comparison for the case that both given version are different. """ given = "1.0.0.dev (Hello, World!)" expected = False actual = Version.literally_compare(given, given.replace(".", "_")) self.assertEqual(expected, actual)
def test_split_version_with_non_digits(self): """ Tests the case that we want to split the version but also have the code name. """ given = "1.0.0.dev (Hello, World!)" expected = (["1", "0", "0"], "dev (Hello, World!)") actual = Version.split_versions(given, return_non_digits=True) self.assertEqual(expected, actual)