diff options
Diffstat (limited to 'pym/portage/tests/dep/test_get_operator.py')
-rw-r--r-- | pym/portage/tests/dep/test_get_operator.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pym/portage/tests/dep/test_get_operator.py b/pym/portage/tests/dep/test_get_operator.py new file mode 100644 index 000000000..b41fab0d5 --- /dev/null +++ b/pym/portage/tests/dep/test_get_operator.py @@ -0,0 +1,31 @@ +# test_match_from_list.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +from unittest import TestCase +from portage.dep import get_operator + +class GetOperator(TestCase): + + def testGetOperator(self): + + # get_operator does not validate operators + tests = [ ( "~", "~" ), ( "=", "=" ), ( ">", ">" ), + ( ">=", ">=" ), ( "<=", "<=" ) , ( "", None ), + ( ">~", ">" ), ("~<", "~"), ( "=~", "=" ), + ( "=>", "=" ), ("=<", "=") ] + + test_cpvs = ["sys-apps/portage","sys-apps/portage-2.1"] + slots = [ None,"1","linux-2.5.6" ] + for cpv in test_cpvs: + for test in tests: + for slot in slots: + atom = cpv[:] + if slot: + atom += ":" + slot + result = get_operator( test[0] + atom ) + self.assertEqual( result, test[1] ) + + result = get_operator( "=sys-apps/portage*" ) + self.assertEqual( result , "=*" ) |