def _read_format(self): format = self._read_line() if format != FORMAT_ONE: raise errors.UnknownContainerFormatError(format)
def _state_expecting_format_line(self): line = self._consume_line() if line is not None: if line != FORMAT_ONE: raise errors.UnknownContainerFormatError(line) self._state_handler = self._state_expecting_record_type
def test_unknown_container_format(self): """Test the formatting of UnknownContainerFormatError.""" e = errors.UnknownContainerFormatError('bad format string') self.assertEqual("Unrecognised container format: 'bad format string'", str(e))