diff --git a/test/test_utils.py b/test/test_utils.py index cf148e17b..9777827ea 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -379,6 +379,27 @@ class IterTest(SupyTestCase): def testRandomChoice(self): choice = utils.iter.choice self.assertRaises(IndexError, choice, {}) + L = [1, 2] + i = iter(L) + L1 = False + L2 = False + i1 = False + i2 = False + for n in xrange(100): + ans = choice(L) + if ans == 1: + L1 = True + else: + L2 = True + ans = choice(i) + if ans == 1: + i1 = True + else: + i2 = True + self.assertEqual(L1 and L2, True, + 'utils.iter.choice isn\'t being random with lists') + self.assertEqual(i1 and i2, True, + 'utils.iter.choice isn\'t being random with iterables') ## def testGroup(self): ## group = utils.iter.group