Exemplo n.º 1
0
 def test_empty_string(self):
     v = _TINCProductVersion('')
     self.assertEquals(v.version, ['x'] * 4)
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('x')
     self.assertEquals(v.version, ['x'] * 4)
     self.assertIsNone(v.hotfix)
Exemplo n.º 2
0
 def test_empty_string(self):
     v = _TINCProductVersion('')
     self.assertEquals(v.version, ['x'] * 4)
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('x')
     self.assertEquals(v.version, ['x'] * 4)
     self.assertIsNone(v.hotfix)
Exemplo n.º 3
0
    def test_lower_bound_filler(self):
        vr = _TINCProductVersionRange('[4.2-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.2.0.0'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.2.3.0'))

        vr = _TINCProductVersionRange('[-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('0.0.0.0'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.2.3.0'))

        #HotFix lower bound

        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
        self.assertTrue(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.3.1.0LA1'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('main'))

        vr = _TINCProductVersionRange('(4.3.1.0LA1-)')
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.3.1.0LA2'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('99.99.99.98'))
Exemplo n.º 4
0
 def test_main_version(self):
     v = _TINCProductVersion('main')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('MAIN')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('mAin')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
Exemplo n.º 5
0
 def test_main_version(self):
     v = _TINCProductVersion('main')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('MAIN')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
     v = _TINCProductVersion('mAin')
     self.assertEquals(v.version, ['99', '99', '99', '99'])
     self.assertIsNone(v.hotfix)
Exemplo n.º 6
0
 def setUp(self):
     super(XidlimitsTests, self).setUp()
     Command('re-build regress.so',
             'make -C %s xidhelper.so' % local_path('.')).run(validateAfter=True)
     SQLTemplateTestCase.perform_transformation_on_sqlfile(local_path('load_xidhelper.sql'),
                                                           local_path('load_xidhelper.sql.t'),
                                                           {'@source@' : local_path('xidhelper.so')})
     PSQL.run_sql_file(sql_file=local_path('load_xidhelper.sql.t'),
                       out_file=local_path('load_xidhelper.out.t'))
     versionstr = self.get_product_version()[1]
     self.use42x_ans = (_TINCProductVersion(versionstr) == _TINCProductVersion('4.2.x'))
     self.gparray = GpArray.initFromCatalog(dbconn.DbURL(), utility=True)
Exemplo n.º 7
0
    def test_version_range(self):
        vr = _TINCProductVersionRange('[4.2.1.0-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.2.1.0'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.2.3.0'))

        #HotFix Version range: Lowerbound check
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.3.1.0LA1'))

        #HotFix Version range: Upperbound check
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.1.0LA1'))
Exemplo n.º 8
0
    def test_version_range(self):
        vr = _TINCProductVersionRange('[4.2.1.0-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.2.1.0'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.2.3.0'))

        #HotFix Version range: Lowerbound check
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.3.1.0LA1'))

        #HotFix Version range: Upperbound check
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.1.0LA1'))
Exemplo n.º 9
0
 def test_with_one_product_version(self):
     tinc_test_case = MockTINCTestCaseWithProductVersionMetadata(
         'test_with_one_product_version')
     self.assertIsNotNone(tinc_test_case.product_version)
     self.assertEquals(
         len(tinc_test_case.product_version.product_version_included), 1)
     self.assertTrue(
         'test' in tinc_test_case.product_version.product_version_included)
     self.assertEquals(
         tinc_test_case.product_version.product_version_included['test'][0],
         _TINCProductVersion('1.0.0.0'))
Exemplo n.º 10
0
    def test_invalid_version_strings(self):
        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            v = _TINCProductVersion('4')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Hotfix can be given only with four part version
            v = _TINCProductVersion('4.2MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything greater than 4 part should throw an exception
            v = _TINCProductVersion('4.2.1.1.1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than digits or 'x' should fail
            v = _TINCProductVersion('4.2.a.1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Just a string should fail
            v = _TINCProductVersion('test.test.test.test')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything beyond hotfix should fail
            v = _TINCProductVersion('4.2.1.3MS1_DEV')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.y.3MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.y.zMS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.xx.1MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Invalid filler string
            v = _TINCProductVersion('4.2MS1', filler='y')
Exemplo n.º 11
0
    def test_invalid_version_strings(self):
        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            v = _TINCProductVersion('4')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Hotfix can be given only with four part version
            v = _TINCProductVersion('4.2MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything greater than 4 part should throw an exception
            v = _TINCProductVersion('4.2.1.1.1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than digits or 'x' should fail
            v = _TINCProductVersion('4.2.a.1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Just a string should fail
            v = _TINCProductVersion('test.test.test.test')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything beyond hotfix should fail
            v = _TINCProductVersion('4.2.1.3MS1_DEV')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.y.3MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.y.zMS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Anything other than x or a digit anywhere should fail
            v = _TINCProductVersion('4.2.xx.1MS1')

        with self.assertRaises(TINCInvalidProductVersionException) as cm:
            # Invalid filler string
            v = _TINCProductVersion('4.2MS1', filler='y')
Exemplo n.º 12
0
    def test_lower_bound_filler(self):
        vr = _TINCProductVersionRange('[4.2-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.2.0.0'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.2.3.0'))

        vr = _TINCProductVersionRange('[-4.2.3.0]')
        self.assertTrue(vr.lower_bound_inclusive and vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('0.0.0.0'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.2.3.0'))

        #HotFix lower bound

        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
        self.assertTrue(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.3.1.0LA1'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('main'))

        vr = _TINCProductVersionRange('(4.3.1.0LA1-)')
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.3.1.0LA2'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('99.99.99.98'))
Exemplo n.º 13
0
    def test_filler(self):
        # Default filler
        v = _TINCProductVersion('4.2.x')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2.x.x')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)

        # Provide filler string
        v = _TINCProductVersion('4.2.x', filler='0')
        self.assertEquals(v.version, ['4', '2', 'x', '0'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2', filler='0')
        self.assertEquals(v.version, ['4', '2', '0', '0'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2.x.x', filler='0')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
Exemplo n.º 14
0
    def test_filler(self):
        # Default filler
        v = _TINCProductVersion('4.2.x')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2.x.x')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)

        # Provide filler string
        v = _TINCProductVersion('4.2.x', filler='0')
        self.assertEquals(v.version, ['4', '2', 'x', '0'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2', filler='0')
        self.assertEquals(v.version, ['4', '2', '0', '0'])
        self.assertIsNone(v.hotfix)
        v = _TINCProductVersion('4.2.x.x', filler='0')
        self.assertEquals(v.version, ['4', '2', 'x', 'x'])
        self.assertIsNone(v.hotfix)
Exemplo n.º 15
0
    def test_match_version(self):
        vr = _TINCProductVersionRange('[4.2-4.4]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.0')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.99.99')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.0.0')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.4.99.99')))

        """
        These cases are not expected. We will always compare with a four part version.
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.1.x')))
        self.assertFalse(vr.match_version(_TINCProductVersion('4.x')))
        """

        # Hotfix matches
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.0.0MS1')))
        # A hotfix version is considered greater than the actual version
        self.assertFalse(vr.match_version(_TINCProductVersion('4.4.99.99MS1')))

        vr = _TINCProductVersionRange('[4.2.6.0-9.99.99.99]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.0EFT')))
        
        #Testing new range for the HOTFIX (4.3.1.0LA1)"
        vr = _TINCProductVersionRange('[4.3.1.0-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix with lowerBound
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix with upperBound
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA2')))

        #Negative test case for version range with hotfix
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA2')))

        #Hotfix range check with other hotfix version
        vr = _TINCProductVersionRange('[-4.3.0.1MA1]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.1LA2')))
Exemplo n.º 16
0
 def test_hotfix(self):
     v = _TINCProductVersion('4.2.1.0MS1')
     self.assertEquals(v.version, ['4', '2', '1', '0'])
     self.assertEquals(v.hotfix, 'MS1')
     with self.assertRaises(TINCInvalidProductVersionException) as cm:
         v = _TINCProductVersion('4.2.x.xMS1')
Exemplo n.º 17
0
    def test_equality(self):
        # Equality operations
        self.assertEquals(_TINCProductVersion('4.2.1.0'),
                          _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('x'),
                          _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('x'), _TINCProductVersion('x'))
        self.assertEquals(_TINCProductVersion('4.2.1'),
                          _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('4.2.1'),
                          _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion('4.2'),
                          _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion('4.x'),
                          _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(''),
                          _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(None),
                          _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(''),
                          _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2'),
                          _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2.x'),
                          _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2.x.99'),
                          _TINCProductVersion('4.2.1.99MS1'))

        # Comparison operations
        self.assertGreater(_TINCProductVersion('4.2.0.0'),
                           _TINCProductVersion('4.1'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'),
                           _TINCProductVersion('4.1.x'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'),
                           _TINCProductVersion('4.1.x.x'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'),
                           _TINCProductVersion('4.1.99.99'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'),
                           _TINCProductVersion('4.1.99.99MS1'))
        self.assertGreater(_TINCProductVersion('main'),
                           _TINCProductVersion('5.10'))
        self.assertGreater(_TINCProductVersion('4.2.2.1A1B1'),
                           _TINCProductVersion('4.2.2.1'))
        self.assertGreater(_TINCProductVersion('4.2.0.0MS1'),
                           _TINCProductVersion('4.2', filler='0'))
        self.assertGreater(_TINCProductVersion('4.2.7', filler='99'),
                           _TINCProductVersion('4.2.7.0MS1'))
Exemplo n.º 18
0
    def test_exclusive_brackets(self):
        vr = _TINCProductVersionRange('(4.2.1.1-4.3)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.2.1.2'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.99.98'))

        vr = _TINCProductVersionRange('(4.2.1.1-4.3]')
        self.assertFalse(vr.lower_bound_inclusive)
        self.assertTrue(vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.2.1.2'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.99.99'))

        vr = _TINCProductVersionRange('[4.2.1.1-4.3)')
        self.assertTrue(vr.lower_bound_inclusive)
        self.assertFalse(vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.2.1.1'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.99.98'))

        vr = _TINCProductVersionRange('(4.2.99.99-4.4.0.0)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.3.0.0'))
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.99.99'))

        #HotFix Version range exclusive bound check
        vr = _TINCProductVersionRange('(4.3.1.0LA1-)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version, _TINCProductVersion('4.3.1.0LA2'))

        vr = _TINCProductVersionRange('(-4.3.1.0LA1)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.upper_bound_version, _TINCProductVersion('4.3.1.0'))
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
Exemplo n.º 19
0
 def test_with_one_product_version(self):
     tinc_test_case = MockTINCTestCaseWithProductVersionMetadata('test_with_one_product_version')
     self.assertIsNotNone(tinc_test_case.product_version)
     self.assertEquals(len(tinc_test_case.product_version.product_version_included), 1)
     self.assertTrue('test' in tinc_test_case.product_version.product_version_included)
     self.assertEquals(tinc_test_case.product_version.product_version_included['test'][0], _TINCProductVersion('1.0.0.0'))
Exemplo n.º 20
0
    def test_decrement(self):
        v = _TINCProductVersion('4.2.1.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.1.0'))
        v = _TINCProductVersion('').decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion('4.2.x').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.x.x'))
        v = _TINCProductVersion('4.x').decr()
        self.assertEquals(v, _TINCProductVersion('4.x.x.x'))
        v = _TINCProductVersion('x').decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion(None).decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion('main').decr()
        self.assertEquals(v, _TINCProductVersion('99.99.99.98'))
        #Modified according to the Hotfix support in the version range
        v = _TINCProductVersion('4.2.1.1MS1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.1.1'))

        v = _TINCProductVersion('4.2.1.0').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.0.99'))
        v = _TINCProductVersion('4.2.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.0.0'))
        v = _TINCProductVersion('4.0.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.0.0.0'))
        v = _TINCProductVersion('0.0.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('0.0.0.0'))
        v = _TINCProductVersion('4.2.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('4.1.99.99'))
        v = _TINCProductVersion('4.0.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('3.99.99.99'))
        v = _TINCProductVersion('0.0.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('0.0.0.0'))
Exemplo n.º 21
0
    def test_decrement(self):
        v = _TINCProductVersion('4.2.1.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.1.0'))
        v = _TINCProductVersion('').decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion('4.2.x').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.x.x'))
        v = _TINCProductVersion('4.x').decr()
        self.assertEquals(v, _TINCProductVersion('4.x.x.x'))
        v = _TINCProductVersion('x').decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion(None).decr()
        self.assertEquals(v, _TINCProductVersion('x.x.x.x'))
        v = _TINCProductVersion('main').decr()
        self.assertEquals(v, _TINCProductVersion('99.99.99.98'))
        #Modified according to the Hotfix support in the version range
        v = _TINCProductVersion('4.2.1.1MS1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.1.1'))

        v = _TINCProductVersion('4.2.1.0').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.0.99'))
        v = _TINCProductVersion('4.2.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.2.0.0'))
        v = _TINCProductVersion('4.0.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('4.0.0.0'))
        v = _TINCProductVersion('0.0.0.1').decr()
        self.assertEquals(v, _TINCProductVersion('0.0.0.0'))
        v = _TINCProductVersion('4.2.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('4.1.99.99'))
        v = _TINCProductVersion('4.0.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('3.99.99.99'))
        v = _TINCProductVersion('0.0.0.0').decr()
        self.assertEquals(v, _TINCProductVersion('0.0.0.0'))
Exemplo n.º 22
0
    def test_equality(self):
        # Equality operations
        self.assertEquals(_TINCProductVersion('4.2.1.0'), _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('x'), _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('x'), _TINCProductVersion('x'))
        self.assertEquals(_TINCProductVersion('4.2.1'), _TINCProductVersion('4.2.1.0'))
        self.assertEquals(_TINCProductVersion('4.2.1'), _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion('4.2'), _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion('4.x'), _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(''), _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(None), _TINCProductVersion('4.2.1.99'))
        self.assertEquals(_TINCProductVersion(''), _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2'), _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2.x'), _TINCProductVersion('4.2.1.99MS1'))
        self.assertEquals(_TINCProductVersion('4.2.x.99'), _TINCProductVersion('4.2.1.99MS1'))

        # Comparison operations
        self.assertGreater(_TINCProductVersion('4.2.0.0'), _TINCProductVersion('4.1'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'), _TINCProductVersion('4.1.x'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'), _TINCProductVersion('4.1.x.x'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'), _TINCProductVersion('4.1.99.99'))
        self.assertGreater(_TINCProductVersion('4.2.0.0'), _TINCProductVersion('4.1.99.99MS1'))
        self.assertGreater(_TINCProductVersion('main'), _TINCProductVersion('5.10'))
        self.assertGreater(_TINCProductVersion('4.2.2.1A1B1'), _TINCProductVersion('4.2.2.1'))
        self.assertGreater(_TINCProductVersion('4.2.0.0MS1'), _TINCProductVersion('4.2', filler='0'))
        self.assertGreater(_TINCProductVersion('4.2.7', filler='99'), _TINCProductVersion('4.2.7.0MS1'))
Exemplo n.º 23
0
    def test_exclusive_brackets(self):
        vr = _TINCProductVersionRange('(4.2.1.1-4.3)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.2.1.2'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.99.98'))

        vr = _TINCProductVersionRange('(4.2.1.1-4.3]')
        self.assertFalse(vr.lower_bound_inclusive)
        self.assertTrue(vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.2.1.2'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.99.99'))

        vr = _TINCProductVersionRange('[4.2.1.1-4.3)')
        self.assertTrue(vr.lower_bound_inclusive)
        self.assertFalse(vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.2.1.1'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.99.98'))

        vr = _TINCProductVersionRange('(4.2.99.99-4.4.0.0)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.3.0.0'))
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.99.99'))

        #HotFix Version range exclusive bound check
        vr = _TINCProductVersionRange('(4.3.1.0LA1-)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.lower_bound_version,
                          _TINCProductVersion('4.3.1.0LA2'))

        vr = _TINCProductVersionRange('(-4.3.1.0LA1)')
        self.assertFalse(vr.lower_bound_inclusive or vr.upper_bound_inclusive)
        self.assertEquals(vr.upper_bound_version,
                          _TINCProductVersion('4.3.1.0'))
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))
Exemplo n.º 24
0
    def test_match_version(self):
        vr = _TINCProductVersionRange('[4.2-4.4]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.0')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.99.99')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.0.0')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.4.99.99')))
        """
        These cases are not expected. We will always compare with a four part version.
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2')))
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.1.x')))
        self.assertFalse(vr.match_version(_TINCProductVersion('4.x')))
        """

        # Hotfix matches
        self.assertTrue(vr.match_version(_TINCProductVersion('4.2.0.0MS1')))
        # A hotfix version is considered greater than the actual version
        self.assertFalse(vr.match_version(_TINCProductVersion('4.4.99.99MS1')))

        vr = _TINCProductVersionRange('[4.2.6.0-9.99.99.99]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.0EFT')))

        #Testing new range for the HOTFIX (4.3.1.0LA1)"
        vr = _TINCProductVersionRange('[4.3.1.0-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix with lowerBound
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix with upperBound
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA1')))

        #Testing Version range with HotFix
        vr = _TINCProductVersionRange('[4.3.1.0LA1-]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.1.0LA2')))

        #Negative test case for version range with hotfix
        vr = _TINCProductVersionRange('[-4.3.1.0LA1]')
        self.assertFalse(vr.match_version(_TINCProductVersion('4.3.1.0LA2')))

        #Hotfix range check with other hotfix version
        vr = _TINCProductVersionRange('[-4.3.0.1MA1]')
        self.assertTrue(vr.match_version(_TINCProductVersion('4.3.0.1LA2')))
Exemplo n.º 25
0
 def test_hotfix(self):
     v = _TINCProductVersion('4.2.1.0MS1')
     self.assertEquals(v.version, ['4', '2', '1', '0'])
     self.assertEquals(v.hotfix, 'MS1')
     with self.assertRaises(TINCInvalidProductVersionException) as cm:
         v = _TINCProductVersion('4.2.x.xMS1')