summaryrefslogtreecommitdiffstats
path: root/pym/portage/tests/versions
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/tests/versions')
-rw-r--r--pym/portage/tests/versions/test_cpv_sort_key.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pym/portage/tests/versions/test_cpv_sort_key.py b/pym/portage/tests/versions/test_cpv_sort_key.py
new file mode 100644
index 000000000..857af1701
--- /dev/null
+++ b/pym/portage/tests/versions/test_cpv_sort_key.py
@@ -0,0 +1,16 @@
+# Copyright 2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.versions import cpv_sort_key
+
+class CpvSortKeyTestCase(TestCase):
+
+ def testCpvSortKey(self):
+
+ tests = [ (( "a", "b", "a/b-2", "a/a-1", "a/b-1"),
+ ( "a", "a/a-1", "a/b-1", "a/b-2", "b")),
+ ]
+
+ for test in tests:
+ self.assertEqual( tuple(sorted(test[0], key=cpv_sort_key())), test[1] )