summaryrefslogtreecommitdiffstats
path: root/tests/portage_dep/test_isjustname.py
blob: a8a4e24bef089f62c69961e557153d5f0874d7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# test_isjustname.py -- Portage Unit Testing Functionality
# Copyright 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: test_atoms.py 5525 2007-01-10 13:35:03Z antarus $

from unittest import TestCase
from portage_dep import isjustname

class IsJustName(TestCase):

        def testIsJustName(self):

		cats = ( "", "sys-apps/", "foo/", "virtual/" )
		pkgs = ( "portage", "paludis", "pkgcore", "notARealPkg" )
		vers = ( "", "-2.0-r3", "-1.0_pre2", "-3.1b" )

		for pkg in pkgs:
			for cat in cats:
				for ver in vers:
					if len(ver):
						self.assertFalse( isjustname( cat + pkg + ver ),
						msg="isjustname(%s) is True!" % (cat + pkg + ver) )
					else:
						self.assertTrue( isjustname( cat + pkg + ver ),
						msg="isjustname(%s) is False!" % (cat + pkg + ver) )