Example #1
0
    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('>=')))
Example #2
0
    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('<=')))
Example #3
0
    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('>=')))
Example #4
0
    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('<=')))
Example #5
0
    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))
Example #6
0
    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))