def test2(self): contents = "1\n2\n3" data_file = StringIO(contents) instance = text.LineBasedFileCursor(data_file) self.assertFalse(instance.is_at_end()) instance.forward() self.assertFalse(instance.is_at_end()) instance.forward() self.assertFalse(instance.is_at_end()) instance.forward() self.assertTrue(instance.is_at_end())
def test1(self): contents = "1\n2\n3" data_file = StringIO(contents) instance = text.LineBasedFileCursor(data_file) self.assertEquals("1", instance.line()) self.assertEquals("1", instance.line()) instance.forward() self.assertEquals("2", instance.line()) instance.forward() self.assertEquals("3", instance.line()) self.assertEquals("3", instance.line())