getslot tests
authorAlec Warner <antarus@gentoo.org>
Thu, 11 Jan 2007 20:20:30 +0000 (20:20 -0000)
committerAlec Warner <antarus@gentoo.org>
Thu, 11 Jan 2007 20:20:30 +0000 (20:20 -0000)
svn path=/main/trunk/; revision=5562

tests/portage_dep/test_dep_getslot.py [new file with mode: 0644]

diff --git a/tests/portage_dep/test_dep_getslot.py b/tests/portage_dep/test_dep_getslot.py
new file mode 100644 (file)
index 0000000..5e18d7c
--- /dev/null
@@ -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:"), "" )