/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

  • Committer: Aaron Bentley
  • Date: 2007-01-05 22:50:02 UTC
  • mto: This revision was merged to the branch mainline in revision 2240.
  • Revision ID: abentley@panoramicfeedback.com-20070105225002-cy0t8kpee9gg6svx
Fix iter_switches behavior when value_switches is true

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        opt = option.Option('hello', help='fg', type=int, argname='gar')
152
152
        self.assertEqual(list(opt.iter_switches()),
153
153
                         [('hello', None, 'GAR', 'fg')])
 
154
        registry = bzrdir.BzrDirFormatRegistry()
 
155
        registry.register_metadir('one', 'RepositoryFormat7', 'one help')
 
156
        registry.register_metadir('two', 'RepositoryFormatKnit1', 'two help')
 
157
        registry.set_default('one')
 
158
        opt = option.RegistryOption('format', 'format help', registry,
 
159
                                    value_switches=False)
 
160
        self.assertEqual(list(opt.iter_switches()),
 
161
                         [('format', None, 'ARG', 'format help')])
 
162
        opt = option.RegistryOption('format', 'format help', registry,
 
163
                                    value_switches=True)
 
164
        self.assertEqual(list(opt.iter_switches()),
 
165
                         [('format', None, 'ARG', 'format help'),
 
166
                          ('default', None, None, 'one help'), 
 
167
                          ('one', None, None, 'one help'), 
 
168
                          ('two', None, None, 'two help'), 
 
169
                          ])
154
170
 
155
171
#     >>> parse_args('log -r 500'.split())
156
172
#     (['log'], {'revision': [<RevisionSpec_int 500>]})