def test_Iteration_Empty(self):
    """Attempts to iterate over no items returns no items"""
    x=InfiniteChooser([])
    
    try:
       x.getCurrentChoice()
       self.fail()
    except IndexError:
       self.assert_(True, "Can't iterate over empty")
    def test_Iteration_Empty(self):
        """Attempts to iterate over no items returns no items"""
        x = InfiniteChooser([])

        try:
            x.getCurrentChoice()
            self.fail()
        except IndexError:
            self.assert_(True, "Can't iterate over empty")
   def test_Iteration_iteratePastEnd(self):
      """Advancing past the end of the set still returns the last item"""
      fruitlist = ["apple","banana","cherry"]
      x=InfiniteChooser(fruitlist)
      
      x.gotoNext()
      x.gotoNext()
      
      result = x.getCurrentChoice()
      # print result
      self.assert_(result == fruitlist[2], "Current choice is 3rd item")

      x.gotoNext()
         
      result = x.getCurrentChoice()
      self.assert_(result == fruitlist[2], "Current choice is 3rd item")
    def test_Iteration_iteratePastEnd(self):
        """Advancing past the end of the set still returns the last item"""
        fruitlist = ["apple", "banana", "cherry"]
        x = InfiniteChooser(fruitlist)

        x.gotoNext()
        x.gotoNext()

        result = x.getCurrentChoice()
        # print result
        self.assert_(result == fruitlist[2], "Current choice is 3rd item")

        x.gotoNext()

        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[2], "Current choice is 3rd item")
 def test_Iteration_iterateForwards(self):
    """Iterating forwards advances forwards through the set"""
    fruitlist = ["apple","banana","cherry"]
    x=InfiniteChooser(fruitlist)
    
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[0], "Current choice is first item")
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[0], "Current choice is still first item")
    
    x.gotoNext()
    
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[1], "Current choice is second item")
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[1], "Current choice is still second item")
    
    x.gotoNext()
    
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[2], "Current choice is 3rd item")
    result = x.getCurrentChoice()
    self.assert_(result == fruitlist[2], "Current choice is still 3rd item")
    def test_Iteration_iterateForwards(self):
        """Iterating forwards advances forwards through the set"""
        fruitlist = ["apple", "banana", "cherry"]
        x = InfiniteChooser(fruitlist)

        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[0], "Current choice is first item")
        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[0],
                     "Current choice is still first item")

        x.gotoNext()

        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[1], "Current choice is second item")
        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[1],
                     "Current choice is still second item")

        x.gotoNext()

        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[2], "Current choice is 3rd item")
        result = x.getCurrentChoice()
        self.assert_(result == fruitlist[2],
                     "Current choice is still 3rd item")