From: Alec Warner Date: Thu, 11 Jan 2007 20:20:30 +0000 (-0000) Subject: getslot tests X-Git-Tag: v2.1.2~69 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cbf8cc5a167980bfc094199ddf781e81eab43e10;p=portage.git getslot tests svn path=/main/trunk/; revision=5562 --- diff --git a/tests/portage_dep/test_dep_getslot.py b/tests/portage_dep/test_dep_getslot.py new file mode 100644 index 000000000..5e18d7cd4 --- /dev/null +++ b/tests/portage_dep/test_dep_getslot.py @@ -0,0 +1,27 @@ +# test_dep_getslot.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_getslot + +class DepGetSlot(TestCase): + """ A simple testcase for isvalidatom + """ + + def testDepGetSlot(self): + + slot_char = ":" + slots = ( "a", "1.2", "1", "IloveVapier", None ) + cpvs = ["sys-apps/portage"] + + for cpv in cpvs: + for slot in slots: + if slot: + self.assertEqual( dep_getslot( + cpv + slot_char + slot ), slot ) + else: + self.assertEqual( dep_getslot( cpv ), slot ) + + self.assertEqual( dep_getslot( "sys-apps/portage:"), "" )