summaryrefslogtreecommitdiff
blob: 90e1b6e56bc30524b68f320e4a84e18233ad8210 (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
26
27
28
29
30
31
# test_dep_getcpv.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 dep_getcpv

class DepGetCPV(TestCase):
        """ A simple testcase for isvalidatom
        """

        def testDepGetCPV(self):
		
		prefix_ops = ["<", ">", "=", "~", "!", "<=", 
			      ">=", "!=", "!<", "!>", "!~",""]

		bad_prefix_ops = [ ">~", "<~", "~>", "~<" ]
		postfix_ops = [ "*", "" ]

		cpvs = ["sys-apps/portage"]

		for cpv in cpvs:
			for prefix in prefix_ops:
				for postfix in postfix_ops:
					self.assertEqual( dep_getcpv( 
						prefix + cpv + postfix ), cpv )
			for prefix in bad_prefix_ops:
				for postfix in postfix_ops:
					self.assertNotEqual( dep_getcpv(
						prefix + cpv + postfix ), cpv )