Exemplo n.º 1
0
 def test_addLineAtEnd(self):
     """
     Verify that, by default, a line added to a history object is added
     after any existing lines.
     """
     s1 = "hello"
     s2 = "world"
     h = History([s1])
     h.addLine(s2)
     self.assertEqual(h.allLines(), [s1, s2])
Exemplo n.º 2
0
 def test_resetPosition(self):
     """
     Verify that the position in the history object can be set to the end
     using the C{resetPosition} method.
     """
     s = "hello"
     h = History()
     h.addLine(s)
     h.previousLine()
     h.resetPosition()
     self.assertEqual(h.nextLine(), "")
Exemplo n.º 3
0
 def test_addLineInMiddle(self):
     """
     Verify that even if the history object is not positioned at the end,
     C{addLine} adds the line to the end.
     """
     s1 = "hello"
     s2 = "world"
     s3 = "goodbye"
     h = History([s1, s2])
     h.previousLine()
     h.addLine(s3)
     self.assertEqual(h.allLines(), [s1, s2, s3])