63
63
"^Filename b?'bad/filen\\\\xe5me' is not valid in your current"
64
64
" filesystem encoding UTF-8$")
66
def test_corrupt_dirstate(self):
67
error = errors.CorruptDirstate('path/to/dirstate', 'the reason why')
69
"Inconsistency in dirstate file path/to/dirstate.\n"
70
"Error: the reason why",
73
def test_dirstate_corrupt(self):
74
error = errors.DirstateCorrupt('.bzr/checkout/dirstate',
75
'trailing garbage: "x"')
76
self.assertEqualDiff("The dirstate file (.bzr/checkout/dirstate)"
77
" appears to be corrupt: trailing garbage: \"x\"",
80
66
def test_duplicate_file_id(self):
81
67
error = errors.DuplicateFileId('a_file_id', 'foo')
82
68
self.assertEqualDiff('File id {a_file_id} already exists in inventory'
239
225
"('key',) which is encoded as 'fulltext'.",
242
def test_unknown_hook(self):
243
error = errors.UnknownHook("branch", "foo")
244
self.assertEqualDiff("The branch hook 'foo' is unknown in this version"
247
error = errors.UnknownHook("tree", "bar")
248
self.assertEqualDiff("The tree hook 'bar' is unknown in this version"
252
def test_unstackable_branch_format(self):
255
error = errors.UnstackableBranchFormat(format, url)
256
self.assertEqualDiff(
257
"The branch '/foo'(foo) is not a stackable format. "
258
"You will need to upgrade the branch to permit branch stacking.",
261
228
def test_unstackable_location(self):
262
229
error = errors.UnstackableLocationError('foo', 'bar')
263
230
self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.",
284
251
error = errors.ReadError(path)
285
252
self.assertContainsRe(str(error), "^Error reading from u?'a path'.$")
287
def test_bad_index_format_signature(self):
288
error = errors.BadIndexFormatSignature("foo", "bar")
289
self.assertEqual("foo is not an index of type bar.",
292
def test_bad_index_data(self):
293
error = errors.BadIndexData("foo")
294
self.assertEqual("Error in data for index foo.",
297
def test_bad_index_duplicate_key(self):
298
error = errors.BadIndexDuplicateKey("foo", "bar")
299
self.assertEqual("The key 'foo' is already in index 'bar'.",
302
def test_bad_index_key(self):
303
error = errors.BadIndexKey("foo")
304
self.assertEqual("The key 'foo' is not a valid key.",
307
def test_bad_index_options(self):
308
error = errors.BadIndexOptions("foo")
309
self.assertEqual("Could not parse options for index foo.",
312
def test_bad_index_value(self):
313
error = errors.BadIndexValue("foo")
314
self.assertEqual("The value 'foo' is not a valid value.",
317
254
def test_bzrerror_from_literal_string(self):
318
255
# Some code constructs BzrError from a literal string, in which case
319
256
# no further formatting is done. (I'm not sure raising the base class
501
438
err = errors.UnknownFormatError('bar', kind='foo')
502
439
self.assertEqual("Unknown foo format: 'bar'", str(err))
504
def test_unknown_rules(self):
505
err = errors.UnknownRules(['foo', 'bar'])
506
self.assertEqual("Unknown rules detected: foo, bar.", str(err))
508
441
def test_tip_change_rejected(self):
509
442
err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
510
443
self.assertEqual(
541
def test_must_have_working_tree(self):
542
err = errors.MustHaveWorkingTree('foo', 'bar')
543
self.assertEqual(str(err), "Branching 'bar'(foo) must create a"
546
474
def test_unresumable_write_group(self):
547
475
repo = "dummy repo"
548
476
wg_tokens = ['token']