示例#1
0
 def test_shuffles(self):
     prev_repeat, utils.repeat = utils.repeat, Mock()
     try:
         utils.repeat.return_value = list(range(10))
         values = {'A', 'B', 'C'}
         cycle = utils.shufflecycle(values)
         seen = set()
         for i in range(10):
             next(cycle)
         utils.repeat.assert_called_with(None)
         assert seen.issubset(values)
         with pytest.raises(StopIteration):
             next(cycle)
             next(cycle)
     finally:
         utils.repeat = prev_repeat
示例#2
0
 def test_shuffles(self):
     prev_repeat, utils.repeat = utils.repeat, Mock()
     try:
         utils.repeat.return_value = list(range(10))
         values = {'A', 'B', 'C'}
         cycle = utils.shufflecycle(values)
         seen = set()
         for i in range(10):
             next(cycle)
         utils.repeat.assert_called_with(None)
         assert seen.issubset(values)
         with pytest.raises(StopIteration):
             next(cycle)
             next(cycle)
     finally:
         utils.repeat = prev_repeat