~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-12 10:26:53 UTC
  • mfrom: (6355 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6404.
  • Revision ID: jelmer@samba.org-20111212102653-tpymqjoodukcgb2v
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2275
2275
        opt = config.Option('foo', default='bar')
2276
2276
        self.assertEquals('bar', opt.get_default())
2277
2277
 
 
2278
    def test_callable_default_value(self):
 
2279
        def bar_as_unicode():
 
2280
            return u'bar'
 
2281
        opt = config.Option('foo', default=bar_as_unicode)
 
2282
        self.assertEquals('bar', opt.get_default())
 
2283
 
2278
2284
    def test_default_value_from_env(self):
2279
2285
        opt = config.Option('foo', default='bar', default_from_env=['FOO'])
2280
2286
        self.overrideEnv('FOO', 'quux')
2296
2302
        self.assertRaises(AssertionError, config.Option, 'foo',
2297
2303
                          default=object())
2298
2304
 
 
2305
    def test_not_supported_callable_default_value_not_unicode(self):
 
2306
        def bar_not_unicode():
 
2307
            return 'bar'
 
2308
        opt = config.Option('foo', default=bar_not_unicode)
 
2309
        self.assertRaises(AssertionError, opt.get_default)
 
2310
 
2299
2311
 
2300
2312
class TestOptionConverterMixin(object):
2301
2313
 
2363
2375
        opt = self.get_option()
2364
2376
        self.assertConverted(16, opt, u'16')
2365
2377
 
 
2378
 
2366
2379
class TestOptionWithListConverter(tests.TestCase, TestOptionConverterMixin):
2367
2380
 
2368
2381
    def get_option(self):
3493
3506
                         (False, ''),],
3494
3507
                        '{foo}{bar}')
3495
3508
 
 
3509
    def test_newline_in_refs_are_not_matched(self):
 
3510
        self.assertRefs([(False, '{\nxx}{xx\n}{{\n}}')], '{\nxx}{xx\n}{{\n}}')
 
3511
 
3496
3512
 
3497
3513
class TestStackExpandOptions(tests.TestCaseWithTransport):
3498
3514