~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_registry.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-09 17:03:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2074.
  • Revision ID: john@arbash-meinel.com-20060909170355-487019ff329aea61
first_is_default was not a good design

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        # test keys()
61
61
        self.assertEqual(['five', 'four', 'one', 'two'], a_registry.keys())
62
62
 
63
 
    def test_registry_with_first_is_default(self):
64
 
        a_registry = registry.Registry(True)
65
 
        self.register_stuff(a_registry)
66
 
 
67
 
        self.failUnless(a_registry.default_key == 'one')
68
 
 
69
 
        # test get() (self.default_key == 'one')
70
 
        self.assertEqual(1, a_registry.get())
71
 
        self.assertEqual(1, a_registry.get(None))
72
 
        self.assertEqual(2, a_registry.get('two'))
73
 
        self.assertRaises(KeyError, a_registry.get, 'three')
74
 
 
75
 
        # test _set_default_key
76
 
        a_registry.default_key = 'five'
77
 
        self.failUnless(a_registry.default_key == 'five')
78
 
        self.assertEqual(5, a_registry.get())
79
 
        self.assertEqual(5, a_registry.get(None))
80
 
        self.assertRaises(KeyError, a_registry.get, 'six')
81
 
        self.assertRaises(KeyError, a_registry._set_default_key, 'six')
82
 
 
83
63
    def test_registry_like_dict(self):
84
64
        a_registry = registry.Registry()
85
65
        self.register_stuff(a_registry)