~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_registry.py

  • Committer: Aaron Bentley
  • Date: 2007-01-16 13:12:54 UTC
  • mto: (2230.3.47 branch6)
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: aaron.bentley@utoronto.ca-20070116131254-sjruli93timappd4
work in progress bind stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for the Registry classes"""
18
18
 
41
41
 
42
42
        self.failUnless(a_registry.default_key is None)
43
43
 
44
 
        # test get() (self.default_key is None)
 
44
        # test get() (self.default_key == None)
45
45
        self.assertRaises(KeyError, a_registry.get)
46
46
        self.assertRaises(KeyError, a_registry.get, None)
47
47
        self.assertEqual(2, a_registry.get('two'))
187
187
                         ], sorted((key, a_registry.get_info(key))
188
188
                                    for key in a_registry.keys()))
189
189
 
190
 
    def test_get_prefix(self):
191
 
        my_registry = registry.Registry()
192
 
        http_object = object()
193
 
        sftp_object = object()
194
 
        my_registry.register('http:', http_object)
195
 
        my_registry.register('sftp:', sftp_object)
196
 
        found_object, suffix = my_registry.get_prefix('http://foo/bar')
197
 
        self.assertEqual('//foo/bar', suffix)
198
 
        self.assertIs(http_object, found_object)
199
 
        self.assertIsNot(sftp_object, found_object)
200
 
        found_object, suffix = my_registry.get_prefix('sftp://baz/qux')
201
 
        self.assertEqual('//baz/qux', suffix)
202
 
        self.assertIs(sftp_object, found_object)
203
 
 
204
190
 
205
191
class TestRegistryWithDirs(TestCaseInTempDir):
206
192
    """Registry tests that require temporary dirs"""