# 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("~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("