166
166
repo.bzrdir.root_transport.base,
169
def test_read_error(self):
170
# a unicode path to check that %r is being used.
172
error = errors.ReadError(path)
173
self.assertEqualDiff("Error reading from u'a path'.", str(error))
169
176
def test_bzrnewerror_is_deprecated(self):
170
177
class DeprecatedError(errors.BzrNewError):
207
214
def test_transport_not_possible(self):
208
e = errors.TransportNotPossible('readonly', 'original error')
209
self.assertEqual('Transport operation not possible:'
210
' readonly original error', str(e))
215
error = errors.TransportNotPossible('readonly', 'original error')
216
self.assertEqualDiff('Transport operation not possible:'
217
' readonly original error', str(error))
212
219
def assertSocketConnectionError(self, expected, *args, **kwargs):
213
220
"""Check the formatting of a SocketConnectionError exception"""
273
280
"Could not understand response from smart server: ('not yes',)",
283
def test_unknown_container_format(self):
284
"""Test the formatting of UnknownContainerFormatError."""
285
e = errors.UnknownContainerFormatError('bad format string')
287
"Unrecognised container format: 'bad format string'",
290
def test_unexpected_end_of_container(self):
291
"""Test the formatting of UnexpectedEndOfContainerError."""
292
e = errors.UnexpectedEndOfContainerError()
294
"Unexpected end of container stream", str(e))
296
def test_unknown_record_type(self):
297
"""Test the formatting of UnknownRecordTypeError."""
298
e = errors.UnknownRecordTypeError("X")
300
"Unknown record type: 'X'",
303
def test_invalid_record(self):
304
"""Test the formatting of InvalidRecordError."""
305
e = errors.InvalidRecordError("xxx")
307
"Invalid record: xxx",
310
def test_container_has_excess_data(self):
311
"""Test the formatting of ContainerHasExcessDataError."""
312
e = errors.ContainerHasExcessDataError("excess bytes")
314
"Container has data after end marker: 'excess bytes'",
317
def test_duplicate_record_name_error(self):
318
"""Test the formatting of DuplicateRecordNameError."""
319
e = errors.DuplicateRecordNameError(u"n\xe5me".encode('utf-8'))
321
"Container has multiple records with the same name: \"n\xc3\xa5me\"",
277
325
class PassThroughError(errors.BzrError):