1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
1
# Copyright (C) 2006-2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
170
170
tree.branch.repository.update_feature_flags({"name": "necessity"})
171
171
found_format = repository.RepositoryFormatMetaDir.find_format(tree.bzrdir)
172
172
self.assertIsInstance(found_format, repository.RepositoryFormatMetaDir)
173
self.assertEqual(found_format.features.get("name"), "necessity")
173
self.assertEquals(found_format.features.get("name"), "necessity")
174
174
self.assertRaises(errors.MissingFeature, found_format.check_support_status,
176
176
self.addCleanup(repository.RepositoryFormatMetaDir.unregister_feature,
188
188
def test_register_unregister_format(self):
189
189
format = SampleRepositoryFormat()
190
190
self.registry.register(format)
191
self.assertEqual(format, self.registry.get("Sample .bzr repository format."))
191
self.assertEquals(format, self.registry.get("Sample .bzr repository format."))
192
192
self.registry.remove(format)
193
193
self.assertRaises(KeyError, self.registry.get, "Sample .bzr repository format.")
195
195
def test_get_all(self):
196
196
format = SampleRepositoryFormat()
197
self.assertEqual([], self.registry._get_all())
197
self.assertEquals([], self.registry._get_all())
198
198
self.registry.register(format)
199
self.assertEqual([format], self.registry._get_all())
199
self.assertEquals([format], self.registry._get_all())
201
201
def test_register_extra(self):
202
202
format = SampleExtraRepositoryFormat()
203
self.assertEqual([], self.registry._get_all())
203
self.assertEquals([], self.registry._get_all())
204
204
self.registry.register_extra(format)
205
self.assertEqual([format], self.registry._get_all())
205
self.assertEquals([format], self.registry._get_all())
207
207
def test_register_extra_lazy(self):
208
self.assertEqual([], self.registry._get_all())
208
self.assertEquals([], self.registry._get_all())
209
209
self.registry.register_extra_lazy("bzrlib.tests.test_repository",
210
210
"SampleExtraRepositoryFormat")
211
211
formats = self.registry._get_all()
212
self.assertEqual(1, len(formats))
212
self.assertEquals(1, len(formats))
213
213
self.assertIsInstance(formats[0], SampleExtraRepositoryFormat)