~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-13 02:43:21 UTC
  • mfrom: (5582.9.2 funky-chars)
  • Revision ID: pqm@pqm.ubuntu.com-20110113024321-d1ssmy4knbv806zp
(jelmer) Avoid hardcoded list of repository formats that do not support
 funky characters in filenames. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    controldir,
23
23
    errors,
24
24
    option,
25
 
    registry,
26
25
    )
27
26
from bzrlib.builtins import cmd_commit
28
27
from bzrlib.commands import parse_args
397
396
        self.assertTrue(format.is_hidden('hidden'))
398
397
        self.assertFalse(format.is_hidden('visible'))
399
398
 
400
 
    def test_short_name(self):
401
 
        registry = controldir.ControlDirFormatRegistry()
402
 
        opt = option.RegistryOption('format', help='', registry=registry)
403
 
        self.assertEquals(None, opt.short_name())
404
 
        opt = option.RegistryOption('format', short_name='F', help='',
405
 
            registry=registry)
406
 
        self.assertEquals('F', opt.short_name())
407
 
 
408
399
    def test_option_custom_help(self):
409
400
        the_opt = option.Option.OPTIONS['help']
410
401
        orig_help = the_opt.help[:]
413
404
        self.assertEqual('suggest lottery numbers', my_opt.help)
414
405
        self.assertEqual(orig_help, the_opt.help)
415
406
 
416
 
    def test_short_value_switches(self):
417
 
        reg = registry.Registry()
418
 
        reg.register('short', 'ShortChoice')
419
 
        reg.register('long', 'LongChoice')
420
 
        ropt = option.RegistryOption('choice', '', reg, value_switches=True,
421
 
            short_value_switches={'short': 's'})
422
 
        opts, args = parse([ropt], ['--short'])
423
 
        self.assertEqual('ShortChoice', opts.choice)
424
 
        opts, args = parse([ropt], ['-s'])
425
 
        self.assertEqual('ShortChoice', opts.choice)
426
 
 
427
407
 
428
408
class TestVerboseQuietLinkage(TestCase):
429
409