Fix Fail test
[portage.git] / tests / test_util.py
1 # test_vercmp.py -- Portage Unit Testing Functionality
2 # Copyright 2006 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $
5
6 from unittest import TestCase, TestLoader
7
8 class UtilTestCase(TestCase):
9         
10         def testUniqueArray(self):
11                 pass
12                 
13         def testVarexpand(self):
14                 pass
15                 
16         def testStackLists(self):
17                 pass
18         
19         def testStackDicts(self):
20                 pass
21         
22         def testStackDictList(self):
23                 from portage_util import stack_dictlist
24                 
25                 tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ]
26                 tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} ))
27                 tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} ))
28                 for test in tests:
29                         self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3],
30                                 msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3],
31                                 stack_dictlist([test[0],test[1]],incremental=test[2])) )
32
33         def testNormalizePath(self):
34                 
35                 from portage_util import normalize_path
36                 path = "///foo/bar/baz"
37                 good = "/foo/bar/baz"
38                 self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good))
39