def test_eof(self): self.assertTrue(LineIterCharBuffer([]).eof()) self.assertTrue(LineIterCharBuffer(['']).eof()) buf = LineIterCharBuffer(['a', 'b']) self.assertFalse(buf.eof()) buf.pop() self.assertFalse(buf.eof()) buf.pop() self.assertTrue(buf.eof())
def test_pop(self): buf = LineIterCharBuffer(['ab', 'c']) self.assertEqual('a', buf.pop()) self.assertEqual('b', buf.pop()) self.assertEqual('c', buf.pop()) self.assertRaises(EmptyBufferException, lambda: buf.pop())