diff options
Diffstat (limited to 'portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py')
-rw-r--r-- | portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py b/portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py new file mode 100644 index 0000000..8a0a8aa --- /dev/null +++ b/portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py @@ -0,0 +1,35 @@ +# test_dep_getcpv.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.dep import dep_getcpv + +class DepGetCPV(TestCase): + """ A simple testcase for isvalidatom + """ + + def testDepGetCPV(self): + + prefix_ops = ["<", ">", "=", "~", "<=", + ">=", "!=", "!<", "!>", "!~"] + + bad_prefix_ops = [ ">~", "<~", "~>", "~<" ] + postfix_ops = [ ("=", "*"), ] + + cpvs = ["sys-apps/portage-2.1", "sys-apps/portage-2.1", + "sys-apps/portage-2.1"] + slots = [None, ":foo", ":2"] + for cpv in cpvs: + for slot in slots: + for prefix in prefix_ops: + mycpv = prefix + cpv + if slot: + mycpv += slot + self.assertEqual( dep_getcpv( mycpv ), cpv ) + + for prefix, postfix in postfix_ops: + mycpv = prefix + cpv + postfix + if slot: + mycpv += slot + self.assertEqual( dep_getcpv( mycpv ), cpv ) |