~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

  • Committer: Aaron Bentley
  • Date: 2007-03-02 20:27:06 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: abentley@panoramicfeedback.com-20070302202706-mriia2sdekme12af
Add RegistryOption.from_swargs to simplify simple registry options

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        self.assertIsInstance(opts.format.repository_format,
170
170
                              knitrepo.RepositoryFormatKnit1)
171
171
 
 
172
    def test_from_kwargs(self):
 
173
        my_option = option.RegistryOption.from_kwargs('my-option',
 
174
            help='test option', short='be short', be_long='go long')
 
175
        self.assertEqual(['my-option'],
 
176
            [x[0] for x in my_option.iter_switches()])
 
177
        my_option = option.RegistryOption.from_kwargs('my-option',
 
178
            help='test option', title="My option", short='be short',
 
179
            be_long='go long', value_switches=True)
 
180
        self.assertEqual(['my-option', 'be-long', 'short'],
 
181
            [x[0] for x in my_option.iter_switches()])
 
182
 
172
183
    def test_help(self):
173
184
        registry = bzrdir.BzrDirFormatRegistry()
174
185
        registry.register_metadir('one', 'RepositoryFormat7', 'one help')