Exemplo n.º 1
0
 def DiffType(self, a, b):
   va = opencsw.ParseVersionString(a["version"])
   vb = opencsw.ParseVersionString(b["version"])
   if va[0] == vb[0]:
     return "revision"
   else:
     return "version"
Exemplo n.º 2
0
 def testExtraStringsHashable(self):
     data = "2.7,REV=2009.06.18_STABLE6"
     expected = (
         '2.7',
         {
             'minor version': '7',
             'major version': '2'
         },
         {
             # Here's the important bit: all parts of the parsed version
             # must be hashable for submitpkg to work.
             'extra_strings': ('STABLE6', ),
             'REV': '2009.06.18',
         })
     result = opencsw.ParseVersionString(data)
     hash(result[2]['extra_strings'])
     self.assertEqual(expected, opencsw.ParseVersionString(data))
Exemplo n.º 3
0
 def test_NoRev(self):
     data = "1.2.3"
     expected = ('1.2.3', {
         'minor version': '2',
         'patchlevel': '3',
         'major version': '1'
     }, {})
     self.assertEqual(expected, opencsw.ParseVersionString(data))
Exemplo n.º 4
0
 def testSmallRev(self):
   data = "4.7.25,REV=2009.10.18_rev=p4"
   expected = (
       '4.7.25',
       {'minor version': '7',
        'patchlevel': '25',
        'major version': '4'},
       {'rev': 'p4',
        'REV': '2009.10.18'})
   self.assertEqual(expected, opencsw.ParseVersionString(data))
Exemplo n.º 5
0
 def testThePflag(self):
     data = "1.6.0,p,REV=2011.02.14"
     expected = ('1.6.0', {
         'minor version': '6',
         'patchlevel': '0',
         'major version': '1'
     }, {
         'extra_strings': ('p', ),
         'REV': '2011.02.14'
     })
     self.assertEqual(expected, opencsw.ParseVersionString(data))
Exemplo n.º 6
0
 def test_Empty(self):
     data = ""
     expected = ('', {'major version': ''}, {})
     self.assertEqual(expected, opencsw.ParseVersionString(data))
Exemplo n.º 7
0
 def test_Text(self):
     data = "That, sir, is a frab-rication! It's wabbit season!"
     # Make sure that we don't crash and return a tuple.  No guarantees
     # for the content.
     self.assertEquals(tuple, type(opencsw.ParseVersionString(data)))