53
53
'It supports versions "(4, 5, 6)" to "(7, 8, 9)".',
56
def test_in_process_transport(self):
57
error = errors.InProcessTransport('fpp')
59
"The transport 'fpp' is only accessible within this process.",
62
56
def test_inventory_modified(self):
63
57
error = errors.InventoryModified("a tree to be repred")
64
58
self.assertEqualDiff("The current inventory for the tree 'a tree to "
172
166
repo.bzrdir.root_transport.base,
175
def test_read_error(self):
176
# a unicode path to check that %r is being used.
178
error = errors.ReadError(path)
179
self.assertEqualDiff("Error reading from u'a path'.", str(error))
181
def test_bad_index_format_signature(self):
182
error = errors.BadIndexFormatSignature("foo", "bar")
183
self.assertEqual("foo is not an index of type bar.",
186
def test_bad_index_data(self):
187
error = errors.BadIndexData("foo")
188
self.assertEqual("Error in data for index foo.",
191
def test_bad_index_duplicate_key(self):
192
error = errors.BadIndexDuplicateKey("foo", "bar")
193
self.assertEqual("The key 'foo' is already in index 'bar'.",
196
def test_bad_index_key(self):
197
error = errors.BadIndexKey("foo")
198
self.assertEqual("The key 'foo' is not a valid key.",
201
def test_bad_index_options(self):
202
error = errors.BadIndexOptions("foo")
203
self.assertEqual("Could not parse options for index foo.",
206
def test_bad_index_value(self):
207
error = errors.BadIndexValue("foo")
208
self.assertEqual("The value 'foo' is not a valid value.",
211
169
def test_bzrnewerror_is_deprecated(self):
212
170
class DeprecatedError(errors.BzrNewError):
249
207
def test_transport_not_possible(self):
250
error = errors.TransportNotPossible('readonly', 'original error')
251
self.assertEqualDiff('Transport operation not possible:'
252
' readonly original error', str(error))
208
e = errors.TransportNotPossible('readonly', 'original error')
209
self.assertEqual('Transport operation not possible:'
210
' readonly original error', str(e))
254
212
def assertSocketConnectionError(self, expected, *args, **kwargs):
255
213
"""Check the formatting of a SocketConnectionError exception"""
315
273
"Could not understand response from smart server: ('not yes',)",
318
def test_unknown_container_format(self):
319
"""Test the formatting of UnknownContainerFormatError."""
320
e = errors.UnknownContainerFormatError('bad format string')
322
"Unrecognised container format: 'bad format string'",
325
def test_unexpected_end_of_container(self):
326
"""Test the formatting of UnexpectedEndOfContainerError."""
327
e = errors.UnexpectedEndOfContainerError()
329
"Unexpected end of container stream", str(e))
331
def test_unknown_record_type(self):
332
"""Test the formatting of UnknownRecordTypeError."""
333
e = errors.UnknownRecordTypeError("X")
335
"Unknown record type: 'X'",
338
def test_invalid_record(self):
339
"""Test the formatting of InvalidRecordError."""
340
e = errors.InvalidRecordError("xxx")
342
"Invalid record: xxx",
345
def test_container_has_excess_data(self):
346
"""Test the formatting of ContainerHasExcessDataError."""
347
e = errors.ContainerHasExcessDataError("excess bytes")
349
"Container has data after end marker: 'excess bytes'",
352
def test_duplicate_record_name_error(self):
353
"""Test the formatting of DuplicateRecordNameError."""
354
e = errors.DuplicateRecordNameError(u"n\xe5me".encode('utf-8'))
356
"Container has multiple records with the same name: \"n\xc3\xa5me\"",
360
277
class PassThroughError(errors.BzrError):