46
46
self.assertEqualDiff('The prefix foo is in the help search path twice.',
49
def test_incompatibleAPI(self):
50
error = errors.IncompatibleAPI("module", (1, 2, 3), (4, 5, 6), (7, 8, 9))
52
'The API for "module" is not compatible with "(1, 2, 3)". '
53
'It supports versions "(4, 5, 6)" to "(7, 8, 9)".',
56
49
def test_inventory_modified(self):
57
50
error = errors.InventoryModified("a tree to be repred")
58
51
self.assertEqualDiff("The current inventory for the tree 'a tree to "
166
159
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))
176
162
def test_bzrnewerror_is_deprecated(self):
177
163
class DeprecatedError(errors.BzrNewError):
214
200
def test_transport_not_possible(self):
215
error = errors.TransportNotPossible('readonly', 'original error')
216
self.assertEqualDiff('Transport operation not possible:'
217
' readonly original error', str(error))
201
e = errors.TransportNotPossible('readonly', 'original error')
202
self.assertEqual('Transport operation not possible:'
203
' readonly original error', str(e))
219
205
def assertSocketConnectionError(self, expected, *args, **kwargs):
220
206
"""Check the formatting of a SocketConnectionError exception"""
280
266
"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\"",
325
270
class PassThroughError(errors.BzrError):