Rev 6470: Fix typo and add tests. in file:///home/vila/src/bzr/bugs/930182-display-reg-options/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Feb 20 17:08:34 UTC 2012
At file:///home/vila/src/bzr/bugs/930182-display-reg-options/
------------------------------------------------------------
revno: 6470
revision-id: v.ladeuil+lp at free.fr-20120220170834-q078ypyk84eb9ng3
parent: v.ladeuil+lp at free.fr-20120217165243-21jmekje3m4xccry
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 930182-display-reg-options
timestamp: Mon 2012-02-20 18:08:34 +0100
message:
Fix typo and add tests.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2012-02-17 16:52:43 +0000
+++ b/bzrlib/tests/test_config.py 2012-02-20 17:08:34 +0000
@@ -3640,6 +3640,41 @@
self.assertEquals('bar', conf.get('foo'))
+class TestStackIterSections(tests.TestCase):
+
+ def test_empty_stack(self):
+ conf = config.Stack([])
+ sections = list(conf.iter_sections())
+ self.assertLength(0, sections)
+
+ def test_empty_store(self):
+ store = config.IniFileStore()
+ store._load_from_string('')
+ conf = config.Stack([store.get_sections])
+ sections = list(conf.iter_sections())
+ self.assertLength(0, sections)
+
+ def test_simple_store(self):
+ store = config.IniFileStore()
+ store._load_from_string('foo=bar')
+ conf = config.Stack([store.get_sections])
+ tuples = list(conf.iter_sections())
+ self.assertLength(1, tuples)
+ (found_store, found_section) = tuples[0]
+ self.assertIs(store, found_store)
+
+ def test_two_stores(self):
+ store1 = config.IniFileStore()
+ store1._load_from_string('foo=bar')
+ store2 = config.IniFileStore()
+ store2._load_from_string('bar=qux')
+ conf = config.Stack([store1.get_sections, store2.get_sections])
+ tuples = list(conf.iter_sections())
+ self.assertLength(2, tuples)
+ self.assertIs(store1, tuples[0][0])
+ self.assertIs(store2, tuples[1][0])
+
+
class TestStackWithTransport(tests.TestCaseWithTransport):
scenarios = [(key, {'get_stack': builder}) for key, builder
@@ -3926,7 +3961,7 @@
''')
self.registry.register(config.ListOption('list'))
# Register an intermediate option as a list to ensure no conversion
- # happen while expanding. Conversion should only occur for the origianl
+ # happen while expanding. Conversion should only occur for the original
# option ('list' here).
self.registry.register(config.ListOption('baz'))
self.assertEquals(['start', 'middle', 'end'],
More information about the bazaar-commits
mailing list