def EnsureAtEnd(self, buffer):  # pylint: disable-msg=redefined-builtin
    """Ensures that the test has verified to the end of the loaded buffer.

    Args:
      buffer: The buffer to load.
    Raises:
      BadOutput: If the buffer is not in a state to have its end checked.
      WrongOutput: If the buffer is not at the end.
    """
    self.Load(buffer)
    self._last_range = (len(self._data), len(self._data))
    if self._line is None:
      if self._data == [''] or not self._data:
        return
      msg = 'Misuse of @end: buffer has not been checked yet.'
      raise BadOutput(self.GetContext(), msg)
    if self._line != len(self._data) - 1:
      raise TooMuchOutput(self.GetContext())
dataset/ETHPy150Open google/vroom/vroom/buffer.py/Manager.EnsureAtEnd/original