def testGreaterThanEqual__compare_version(self): """ version.compare_version: greater than or equal to's. """ for i in range(len(self.version)): # lower versions self.assertTrue(compare_version(_mkver('>=', i, -1))) # higher versions self.assertFalse(compare_version(_mkver('>=', i, 1))) # zeros self.assertTrue(compare_version('>=0.0')) self.assertTrue(compare_version('>=0.0.0')) self.assertTrue(compare_version(_mkver('>=')))
def testLessThanEqual__compare_version(self): """ version.compare_version: less than or equal to's. """ for i in range(len(self.version)): # earlier versions self.assertFalse(compare_version(_mkver('<=', i, -1))) # later versions self.assertTrue(compare_version(_mkver('<=', i, 1))) # zeros self.assertFalse(compare_version('<=0.0')) self.assertFalse(compare_version('<=0.0.0')) self.assertTrue(compare_version(_mkver('<=')))
def testInvalidFormat__compare_version(self): """ version.compare_version: invalid values. """ for v in ('<-1', '<-1.2.0', '>-5.0', '<JjN$#$&88', '<=AKJ#*jdf', '==AB*#*U#$J' '>AKJ#*jdf', '>=j#$OF*U$%', None, tuple(), list(), object(), dict(), set()): self.assertFalse(compare_version(v))