aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py')
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py146
1 files changed, 0 insertions, 146 deletions
diff --git a/portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py b/portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py
deleted file mode 100644
index 173ab0d..0000000
--- a/portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright 2006-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from portage.tests import TestCase
-from portage.dep import isvalidatom
-
-class IsValidAtomTestCase(object):
- def __init__(self, atom, expected, allow_wildcard=False, allow_repo=False):
- self.atom = atom
- self.expected = expected
- self.allow_wildcard = allow_wildcard
- self.allow_repo = allow_repo
-
-class IsValidAtom(TestCase):
-
- def testIsValidAtom(self):
-
- test_cases = (
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("=sys-apps/portage-2.1", True),
- IsValidAtomTestCase("=sys-apps/portage-2.1*", True),
- IsValidAtomTestCase(">=sys-apps/portage-2.1", True),
- IsValidAtomTestCase("<=sys-apps/portage-2.1", True),
- IsValidAtomTestCase(">sys-apps/portage-2.1", True),
- IsValidAtomTestCase("<sys-apps/portage-2.1", True),
- IsValidAtomTestCase("~sys-apps/portage-2.1", True),
- IsValidAtomTestCase("sys-apps/portage:foo", True),
- IsValidAtomTestCase("sys-apps/portage-2.1:foo", False),
- IsValidAtomTestCase( "sys-apps/portage-2.1:", False),
- IsValidAtomTestCase("sys-apps/portage-2.1:", False),
- IsValidAtomTestCase("sys-apps/portage-2.1:[foo]", False),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
- IsValidAtomTestCase("sys-apps/portage", True),
-
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar?,!baz?,!doc=,build=]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[doc?]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!doc?]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[doc=]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!doc=]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!doc]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!-doc]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!-doc=]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[!-doc?]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[-doc?]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[-doc=]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[-doc!=]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[-doc=]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar][-baz][doc?][!build?]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar,-baz,doc?,!build?]", True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar,-baz,doc?,!build?,]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[,bar,-baz,doc?,!build?]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar,-baz][doc?,!build?]", False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo[bar][doc,build]", False),
- IsValidAtomTestCase(">~cate-gory/foo-1.0", False),
- IsValidAtomTestCase(">~category/foo-1.0", False),
- IsValidAtomTestCase("<~category/foo-1.0", False),
- IsValidAtomTestCase("###cat/foo-1.0", False),
- IsValidAtomTestCase("~sys-apps/portage", False),
- IsValidAtomTestCase("portage", False),
- IsValidAtomTestCase("=portage", False),
- IsValidAtomTestCase(">=portage-2.1", False),
- IsValidAtomTestCase("~portage-2.1", False),
- IsValidAtomTestCase("=portage-2.1*", False),
- IsValidAtomTestCase("null/portage", True),
- IsValidAtomTestCase("null/portage*:0", False),
- IsValidAtomTestCase(">=null/portage-2.1", True),
- IsValidAtomTestCase(">=null/portage", False),
- IsValidAtomTestCase(">null/portage", False),
- IsValidAtomTestCase("=null/portage*", False),
- IsValidAtomTestCase("=null/portage", False),
- IsValidAtomTestCase("~null/portage", False),
- IsValidAtomTestCase("<=null/portage", False),
- IsValidAtomTestCase("<null/portage", False),
- IsValidAtomTestCase("~null/portage-2.1", True),
- IsValidAtomTestCase("=null/portage-2.1*", True),
- IsValidAtomTestCase("null/portage-2.1*", False),
- IsValidAtomTestCase("app-doc/php-docs-20071125", False),
- IsValidAtomTestCase("app-doc/php-docs-20071125-r2", False),
- IsValidAtomTestCase("=foo/bar-1-r1-1-r1", False),
- IsValidAtomTestCase("foo/-z-1", False),
-
- # These are invalid because pkg name must not end in hyphen
- # followed by numbers
- IsValidAtomTestCase("=foo/bar-1-r1-1-r1", False),
- IsValidAtomTestCase("=foo/bar-123-1", False),
- IsValidAtomTestCase("=foo/bar-123-1*", False),
- IsValidAtomTestCase("foo/bar-123", False),
- IsValidAtomTestCase("=foo/bar-123-1-r1", False),
- IsValidAtomTestCase("=foo/bar-123-1-r1*", False),
- IsValidAtomTestCase("foo/bar-123-r1", False),
- IsValidAtomTestCase("foo/bar-1", False),
-
- IsValidAtomTestCase("=foo/bar--baz-1-r1", True),
- IsValidAtomTestCase("=foo/bar-baz--1-r1", True),
- IsValidAtomTestCase("=foo/bar-baz---1-r1", True),
- IsValidAtomTestCase("=foo/bar-baz---1", True),
- IsValidAtomTestCase("=foo/bar-baz-1--r1", False),
- IsValidAtomTestCase("games-strategy/ufo2000", True),
- IsValidAtomTestCase("~games-strategy/ufo2000-0.1", True),
- IsValidAtomTestCase("=media-libs/x264-20060810", True),
- IsValidAtomTestCase("foo/b", True),
- IsValidAtomTestCase("app-text/7plus", True),
- IsValidAtomTestCase("foo/666", True),
- IsValidAtomTestCase("=dev-libs/poppler-qt3-0.11*", True),
-
- #Testing atoms with repositories
- IsValidAtomTestCase("sys-apps/portage::repo_123-name", True, allow_repo=True),
- IsValidAtomTestCase("=sys-apps/portage-2.1::repo", True, allow_repo=True),
- IsValidAtomTestCase("=sys-apps/portage-2.1*::repo", True, allow_repo=True),
- IsValidAtomTestCase("sys-apps/portage:foo::repo", True, allow_repo=True),
- IsValidAtomTestCase("sys-apps/portage-2.1:foo::repo", False, allow_repo=True),
- IsValidAtomTestCase("sys-apps/portage-2.1:::repo", False, allow_repo=True),
- IsValidAtomTestCase("sys-apps/portage-2.1:::repo[foo]", False, allow_repo=True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo::repo[bar?,!baz?,!doc=,build=]", True, allow_repo=True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo::repo[doc?]", True, allow_repo=True),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo::repo[!doc]", False, allow_repo=True),
- IsValidAtomTestCase("###cat/foo-1.0::repo", False, allow_repo=True),
- IsValidAtomTestCase("~sys-apps/portage::repo", False, allow_repo=True),
- IsValidAtomTestCase("portage::repo", False, allow_repo=True),
- IsValidAtomTestCase("=portage::repo", False, allow_repo=True),
- IsValidAtomTestCase("null/portage::repo", True, allow_repo=True),
- IsValidAtomTestCase("app-doc/php-docs-20071125::repo", False, allow_repo=True),
- IsValidAtomTestCase("=foo/bar-1-r1-1-r1::repo", False, allow_repo=True),
-
- IsValidAtomTestCase("sys-apps/portage::repo_123-name", False, allow_repo=False),
- IsValidAtomTestCase("=sys-apps/portage-2.1::repo", False, allow_repo=False),
- IsValidAtomTestCase("=sys-apps/portage-2.1*::repo", False, allow_repo=False),
- IsValidAtomTestCase("sys-apps/portage:foo::repo", False, allow_repo=False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo::repo[bar?,!baz?,!doc=,build=]", False, allow_repo=False),
- IsValidAtomTestCase("=sys-apps/portage-2.2*:foo::repo[doc?]", False, allow_repo=False),
- IsValidAtomTestCase("null/portage::repo", False, allow_repo=False),
- )
-
- for test_case in test_cases:
- if test_case.expected:
- atom_type = "valid"
- else:
- atom_type = "invalid"
- self.assertEqual( bool(isvalidatom(test_case.atom, allow_wildcard=test_case.allow_wildcard, \
- allow_repo=test_case.allow_repo)), test_case.expected,
- msg="isvalidatom(%s) != %s" % ( test_case.atom, test_case.expected ) )