Exemplo n.º 1
0
    def test_sign(self):
        """
        Test the diff in both directions, validate they are the same and of opposite signs.
        """
        v1 = "0.1"
        v2 = "0.2"

        self.assertTrue(version_diff(v1, v2) < 0, "First version earlier than the second returns negative.")
        self.assertTrue(version_diff(v2, v1) > 0, "Second version earlier than the first returns positive.")
        self.assertTrue(version_diff(v2, v2) == 0, "First version equals the second returns 0.")
Exemplo n.º 2
0
    def test_sign(self):
        """
        Test the diff in both directions, validate they are the same and of opposite signs.
        """
        v1 = "0.1"
        v2 = "0.2"

        self.assertTrue(version_diff(v1, v2) < 0, "First version earlier than the second returns negative.")
        self.assertTrue(version_diff(v2, v1) > 0, "Second version earlier than the first returns positive.")
        self.assertTrue(version_diff(v2, v2) == 0, "First version equals the second returns 0.")
Exemplo n.º 3
0
    def test_levels(self):
        """
        Test major, minor, and patch-level differences.
        """

        self.assertEqual(version_diff("1", "2"), -1, "Major version diff (no minor)")
        self.assertEqual(version_diff("1.0", "2.0"), -1, "Major version diff (matching minor)")

        self.assertEqual(version_diff("0.1", "0.2"), -1, "Minor version diff (no patch)")
        self.assertEqual(version_diff("0.1.0", "0.2.0"), -1, "Minor version diff (matching patch)")

        self.assertEqual(version_diff("0.0.1", "0.0.2"), -1, "Patch version diff (no sub-patch)")
        self.assertEqual(version_diff("0.0.1.0", "0.0.2.0"), -1, "Patch version diff (matching sub-patch)")
Exemplo n.º 4
0
    def test_levels(self):
        """
        Test major, minor, and patch-level differences.
        """

        self.assertEqual(version_diff("1", "2"), -1, "Major version diff (no minor)")
        self.assertEqual(version_diff("1.0", "2.0"), -1, "Major version diff (matching minor)")

        self.assertEqual(version_diff("0.1", "0.2"), -1, "Minor version diff (no patch)")
        self.assertEqual(version_diff("0.1.0", "0.2.0"), -1, "Minor version diff (matching patch)")

        self.assertEqual(version_diff("0.0.1", "0.0.2"), -1, "Patch version diff (no sub-patch)")
        self.assertEqual(version_diff("0.0.1.0", "0.0.2.0"), -1, "Patch version diff (matching sub-patch)")
Exemplo n.º 5
0
 def test_values(self):
     """
     Test a few different values for the difference
     """
     self.assertEqual(version_diff("0.1", "0.20"), -19, "abs(diff) > 10")
Exemplo n.º 6
0
 def test_values(self):
     """
     Test a few different values for the difference
     """
     self.assertEqual(version_diff("0.1", "0.20"), -19, "abs(diff) > 10")