summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Henstridge <james@jamesh.id.au>2008-12-03 08:46:23 +0900
committerJames Henstridge <james@jamesh.id.au>2008-12-03 08:46:23 +0900
commitb93aae1ca4d3639149c48fdd9939f0f77ab29afb (patch)
tree851bccf48c70089a41e6e221858be6e458e6468b /lib
parent42881dd0563b56417bd11112cefc6d332d7a2a42 (diff)
downloadtestresources-b93aae1ca4d3639149c48fdd9939f0f77ab29afb.tar.gz
Test all permutations in testSortIsStableWithinGroups.
Diffstat (limited to 'lib')
-rw-r--r--lib/testresources/tests/test_optimising_test_suite.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/testresources/tests/test_optimising_test_suite.py b/lib/testresources/tests/test_optimising_test_suite.py
index 80a10bb..73da09b 100644
--- a/lib/testresources/tests/test_optimising_test_suite.py
+++ b/lib/testresources/tests/test_optimising_test_suite.py
@@ -437,14 +437,11 @@ class TestGraphStuff(testtools.TestCase):
self.case3.resources = [("_one", resource_one), ("_two", resource_two)]
self.case4.resources = [("_one", resource_one), ("_two", resource_two)]
- tests = self.sortTests([self.case1, self.case2, self.case3, self.case4])
- self.assertTrue(tests.index(self.case1) < tests.index(self.case2))
- self.assertTrue(tests.index(self.case3) < tests.index(self.case4))
-
- tests = self.sortTests([self.case2, self.case1, self.case3, self.case4])
- self.assertTrue(tests.index(self.case2) < tests.index(self.case1))
- self.assertTrue(tests.index(self.case3) < tests.index(self.case4))
-
- tests = self.sortTests([self.case4, self.case3, self.case2, self.case1])
- self.assertTrue(tests.index(self.case2) < tests.index(self.case1))
- self.assertTrue(tests.index(self.case4) < tests.index(self.case3))
+ for permutation in self._permute_four(self.cases):
+ sorted = self.sortTests(permutation)
+ self.assertEqual(
+ permutation.index(self.case1) < permutation.index(self.case2),
+ sorted.index(self.case1) < sorted.index(self.case2))
+ self.assertEqual(
+ permutation.index(self.case3) < permutation.index(self.case4),
+ sorted.index(self.case3) < sorted.index(self.case4))