Tests: Add tests for portage.dep.dep_opconvert
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 10 Aug 2010 21:38:55 +0000 (23:38 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Aug 2010 05:31:02 +0000 (22:31 -0700)
pym/portage/tests/dep/testStandalone.py

index a5d661cc32318055548f1bf30dd8b731685a29e7..f018902e59092032df49b3dc7831455d9cd6b122 100644 (file)
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase
-from portage.dep import cpvequal, flatten
+from portage.dep import cpvequal, dep_opconvert, flatten
 from portage.exception import PortageException
 
 class TestStandalone(TestCase):
@@ -48,3 +48,15 @@ class TestStandalone(TestCase):
 
                for not_flat, flat in test_cases:
                        self.assertEqual(flatten(not_flat), flat)
+
+       def testDep_opconvert(self):
+
+               test_cases = (
+                       ( [], [] ),
+                       ( ["blah", "||", ["foo", "bar", "baz"]], ["blah", ["||", "foo", "bar", "baz"]] ),
+                       ( [["a", "b"], "||", ["c", "d", "e"]], [["a", "b"], ["||", "c", "d", "e"]] ),
+                       ( ["||", ["a", "b"], "||", ["c", "d", "e"]], [["||", "a", "b"], ["||", "c", "d", "e"]] ),
+               )
+
+               for orig, expected in test_cases:
+                       self.assertEqual(dep_opconvert(orig), expected)