def test_compare_versions(self): # <current, upstream> # 1 upstream newer than current # 0 same version or upsteam none # -1 current newer than upstream self.assertEqual(checkversions.compare_versions('1.2.3', '1.2.4'), 1) self.assertEqual(checkversions.compare_versions('123', None), 0) self.assertEqual(checkversions.compare_versions('1.2.3', '1.2.3'), 0) self.assertEqual(checkversions.compare_versions('1.2.4', '1.2.3'), -1)
def test_compare_versions(self): # <current, upstream> # 1 upstream newer than current # 0 same version or upsteam none # -1 current newer than upstream self.assertEqual(checkversions.compare_versions('1.2.3', '1.2.4'), 1) self.assertEqual(checkversions.compare_versions('123', None), 0) self.assertEqual(checkversions.compare_versions('1.2.3', '1.2.3'), 0) self.assertEqual(checkversions.compare_versions(None, None), 0) self.assertEqual(checkversions.compare_versions('', '1.2.3'), 0) self.assertEqual(checkversions.compare_versions('1.2.4', '1.2.3'), -1)
def test_compare_versions(self): # <current, upstream> # 1 upstream newer than current # 0 same version or upsteam none # -1 current newer than upstream self.assertEqual(checkversions.compare_versions("1.2.3", "1.2.4"), 1) self.assertEqual(checkversions.compare_versions("123", None), 0) self.assertEqual(checkversions.compare_versions("1.2.3", "1.2.3"), 0) self.assertEqual(checkversions.compare_versions(None, None), 0) self.assertEqual(checkversions.compare_versions("", "1.2.3"), 0) self.assertEqual(checkversions.compare_versions("1.2.4", "1.2.3"), -1)
def test_bts642032(self): vers = checkversions.get_versions_available('reportbug', 60) # check stable version is lower than unstable chk = checkversions.compare_versions(vers['stable'], vers['unstable']) self.assertEqual(chk, 1)
def test_bts642032(self): vers = checkversions.get_versions_available('reportbug', 60) # check stable version is lower than unstable chk = checkversions.compare_versions(vers['stable'], vers['unstable']) self.assertGreaterEqual(chk, 0)