From 68cee055aba91242c664f4c59606ffce73f4ce37 Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Wed, 10 Jan 2007 13:45:27 +0000 Subject: [PATCH] split out util tests svn path=/main/trunk/; revision=5529 --- tests/portage_util/test_normalizedPath.py | 16 ++++++++++++++++ tests/portage_util/test_stackDictList.py | 19 +++++++++++++++++++ tests/portage_util/test_stackDicts.py | 11 +++++++++++ tests/portage_util/test_stackLists.py | 11 +++++++++++ tests/portage_util/test_uniqueArray.py | 11 +++++++++++ tests/portage_util/test_util.py | 19 ------------------- tests/portage_util/test_varExpand.py | 11 +++++++++++ 7 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 tests/portage_util/test_normalizedPath.py create mode 100644 tests/portage_util/test_stackDictList.py create mode 100644 tests/portage_util/test_stackDicts.py create mode 100644 tests/portage_util/test_stackLists.py create mode 100644 tests/portage_util/test_uniqueArray.py create mode 100644 tests/portage_util/test_varExpand.py diff --git a/tests/portage_util/test_normalizedPath.py b/tests/portage_util/test_normalizedPath.py new file mode 100644 index 000000000..9f9a60597 --- /dev/null +++ b/tests/portage_util/test_normalizedPath.py @@ -0,0 +1,16 @@ +# test_normalizePath.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase + +class NormalizePathTestCase(TestCase): + + def testNormalizePath(self): + + from portage_util import normalize_path + path = "///foo/bar/baz" + good = "/foo/bar/baz" + self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good)) + diff --git a/tests/portage_util/test_stackDictList.py b/tests/portage_util/test_stackDictList.py new file mode 100644 index 000000000..e6442ce43 --- /dev/null +++ b/tests/portage_util/test_stackDictList.py @@ -0,0 +1,19 @@ +# test_stackDictList.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase + +class StackDictListTestCase(TestCase): + + def testStackDictList(self): + from portage_util import stack_dictlist + + tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ] + tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} )) + tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} )) + for test in tests: + self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3], + msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3], + stack_dictlist([test[0],test[1]],incremental=test[2])) ) diff --git a/tests/portage_util/test_stackDicts.py b/tests/portage_util/test_stackDicts.py new file mode 100644 index 000000000..dd0743509 --- /dev/null +++ b/tests/portage_util/test_stackDicts.py @@ -0,0 +1,11 @@ +# test_stackDicts.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase + +class StackDictsTestCase(TestCase): + + def testStackDicts(self): + pass diff --git a/tests/portage_util/test_stackLists.py b/tests/portage_util/test_stackLists.py new file mode 100644 index 000000000..955f41ad8 --- /dev/null +++ b/tests/portage_util/test_stackLists.py @@ -0,0 +1,11 @@ +# test_stackLists.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase + +class StackListsTestCase(TestCase): + + def testStackLists(self): + pass diff --git a/tests/portage_util/test_uniqueArray.py b/tests/portage_util/test_uniqueArray.py new file mode 100644 index 000000000..654eb4b1c --- /dev/null +++ b/tests/portage_util/test_uniqueArray.py @@ -0,0 +1,11 @@ +# test_uniqueArray.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase + +class UniqueArrayTestCase(TestCase): + + def testUniqueArray(self): + pass diff --git a/tests/portage_util/test_util.py b/tests/portage_util/test_util.py index e16da6c1d..ddbfb8031 100644 --- a/tests/portage_util/test_util.py +++ b/tests/portage_util/test_util.py @@ -18,22 +18,3 @@ class UtilTestCase(TestCase): def testStackDicts(self): pass - - def testStackDictList(self): - from portage_util import stack_dictlist - - tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ] - tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} )) - tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} )) - for test in tests: - self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3], - msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3], - stack_dictlist([test[0],test[1]],incremental=test[2])) ) - - def testNormalizePath(self): - - from portage_util import normalize_path - path = "///foo/bar/baz" - good = "/foo/bar/baz" - self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good)) - diff --git a/tests/portage_util/test_varExpand.py b/tests/portage_util/test_varExpand.py new file mode 100644 index 000000000..e7bb62b67 --- /dev/null +++ b/tests/portage_util/test_varExpand.py @@ -0,0 +1,11 @@ +# test_varExpand.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase, TestLoader + +class VarExpandTestCase(TestCase): + + def testVarexpand(self): + pass -- 2.26.2