428
428
def test_format_initialize_find_open(self):
429
429
# loopback test to check the current format initializes to itself.
430
made_branch = self.make_branch('.')
430
if not self.branch_format.is_supported():
431
# unsupported formats are not loopback testable
432
# because the default open will not open them and
433
# they may not be initializable.
435
# supported formats must be able to init and open
436
t = get_transport('.')
437
made_branch = self.branch_format.initialize(t.base)
431
438
self.failUnless(isinstance(made_branch, branch.Branch))
432
t = get_transport('.')
433
439
self.assertEqual(self.branch_format,
434
440
branch.BzrBranchFormat.find_format(t))
435
opened_branch = self.branch_format.open(t)
436
self.assertEqual(made_branch._branch_format, opened_branch._branch_format)
441
direct_opened_branch = self.branch_format.open(t)
442
opened_branch = branch.Branch.open(t.base)
443
self.assertEqual(made_branch._branch_format,
444
opened_branch._branch_format)
445
self.assertEqual(direct_opened_branch._branch_format,
446
opened_branch._branch_format)
437
447
self.failUnless(isinstance(opened_branch, branch.Branch))
439
449
def test_open_not_branch(self):