def test_Iteration_backwardsPastStart(self): """Backstepping past the start of the set still returns the first item""" fruitlist = ["apple","banana","cherry"] x=Chooser(fruitlist) result = x.getCurrentChoice() self.assert_(result == fruitlist[0], "Current choice is first item") x.gotoPrev() result = x.getCurrentChoice() self.assert_(result == fruitlist[0], "Current choice is still first item")
def test_Iteration_backwardsPastStart(self): """Backstepping past the start of the set still returns the first item""" fruitlist = ["apple", "banana", "cherry"] x = Chooser(fruitlist) result = x.getCurrentChoice() self.assert_(result == fruitlist[0], "Current choice is first item") x.gotoPrev() result = x.getCurrentChoice() self.assert_(result == fruitlist[0], "Current choice is still first item")
def test_Iterate_forwardsBackwardsForwards(self): fruitlist = ["apple","banana","cherry"] x=Chooser(fruitlist) self.assert_(x.getCurrentChoice() == fruitlist[0], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[2], "Current choice is correct") x.gotoPrev() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct") x.gotoPrev() self.assert_(x.getCurrentChoice() == fruitlist[0], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct")
def test_Iterate_forwardsBackwardsForwards(self): fruitlist = ["apple", "banana", "cherry"] x = Chooser(fruitlist) self.assert_(x.getCurrentChoice() == fruitlist[0], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[2], "Current choice is correct") x.gotoPrev() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct") x.gotoPrev() self.assert_(x.getCurrentChoice() == fruitlist[0], "Current choice is correct") x.gotoNext() self.assert_(x.getCurrentChoice() == fruitlist[1], "Current choice is correct")