def test_pop(self): buf = CharBuffer('a') self.assertEqual('a', buf.pop()) self.assertRaises(EmptyBufferException, lambda: buf.pop())
def test_eof(self): self.assertTrue(CharBuffer('').eof()) buf = CharBuffer('x') self.assertFalse(buf.eof()) buf.pop() self.assertTrue(buf.eof())
def test_peek(self): buf = CharBuffer('a') self.assertEqual('a', buf.peek()) buf.pop() self.assertIsNone(buf.peek())