~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Aaron Bentley
  • Date: 2006-12-21 04:34:42 UTC
  • mto: (2255.1.1 bzr.ab.integration)
  • mto: This revision was merged to the branch mainline in revision 2220.
  • Revision ID: aaron.bentley@utoronto.ca-20061221043442-x3mv0kxnsu7c2z5j
restore register_lazy, remove register_factory, other updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
 
60
60
    def make_format_registry(self):
61
61
        my_format_registry = bzrdir.BzrDirFormatRegistry()
62
 
        my_format_registry.register_factory('weave', bzrdir.BzrDirFormat6,
 
62
        my_format_registry.register('weave', bzrdir.BzrDirFormat6,
63
63
            'Pre-0.8 format.  Slower and does not support checkouts or shared'
64
64
            ' repositories', deprecated=True)
65
 
        my_format_registry.register('direct', lambda x: bzrdir.BzrDirFormat6(),
66
 
            'Format registered directly', deprecated=True)
 
65
        my_format_registry.register_lazy('lazy', 'bzrlib.bzrdir', 
 
66
            'BzrDirFormat6', 'Format registered lazily', deprecated=True)
67
67
        my_format_registry.register_metadir('knit', 'RepositoryFormatKnit1',
68
68
            'Format using knits')
69
69
        my_format_registry.set_default('knit')
76
76
 
77
77
    def test_format_registry(self):
78
78
        my_format_registry = self.make_format_registry()
79
 
        my_bzrdir = my_format_registry.make_bzrdir('direct')
80
 
        self.assertTrue(isinstance(my_bzrdir, bzrdir.BzrDirFormat6))
 
79
        my_bzrdir = my_format_registry.make_bzrdir('lazy')
 
80
        self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
81
81
        my_bzrdir = my_format_registry.make_bzrdir('weave')
82
 
        self.assertTrue(isinstance(my_bzrdir, bzrdir.BzrDirFormat6))
 
82
        self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
83
83
        my_bzrdir = my_format_registry.make_bzrdir('default')
84
 
        self.assertTrue(isinstance(my_bzrdir.repository_format, 
85
 
            repository.RepositoryFormatKnit1))
 
84
        self.assertIsInstance(my_bzrdir.repository_format, 
 
85
            repository.RepositoryFormatKnit1)
86
86
        my_bzrdir = my_format_registry.make_bzrdir('knit')
87
 
        self.assertTrue(isinstance(my_bzrdir.repository_format, 
88
 
            repository.RepositoryFormatKnit1))
 
87
        self.assertIsInstance(my_bzrdir.repository_format, 
 
88
            repository.RepositoryFormatKnit1)
89
89
        my_bzrdir = my_format_registry.make_bzrdir('metaweave')
90
 
        self.assertTrue(isinstance(my_bzrdir.repository_format, 
91
 
            repository.RepositoryFormat7))
92
 
 
93
 
    def test_lazy(self):
94
 
        my_format_registry = bzrdir.BzrDirFormatRegistry()
95
 
        self.assertRaises(NotImplementedError, 
96
 
                          my_format_registry.register_lazy)
 
90
        self.assertIsInstance(my_bzrdir.repository_format, 
 
91
            repository.RepositoryFormat7)
97
92
 
98
93
    def test_get_help(self):
99
94
        my_format_registry = self.make_format_registry()
100
 
        self.assertEqual('Format registered directly',
101
 
                         my_format_registry.get_help('direct'))
 
95
        self.assertEqual('Format registered lazily',
 
96
                         my_format_registry.get_help('lazy'))
102
97
        self.assertEqual('Format using knits', 
103
98
                         my_format_registry.get_help('knit'))
104
99
        self.assertEqual('Format using knits', 
117
112
        self.assertContainsRe(new, 
118
113
            '  knit/default:\n    \(native\) Format using knits\n')
119
114
        self.assertContainsRe(deprecated, 
120
 
            '  direct:\n    \(native\) Format registered directly\n')
 
115
            '  lazy:\n    \(native\) Format registered lazily\n')
121
116
 
122
117
class SampleBranch(bzrlib.branch.Branch):
123
118
    """A dummy branch for guess what, dummy use."""