[kernel] r9194 - people/waldi/dkt/lib/dkt/config/test
Bastian Blank
waldi at alioth.debian.org
Tue Jul 24 22:43:20 UTC 2007
Author: waldi
Date: Tue Jul 24 22:43:20 2007
New Revision: 9194
Log:
* lib/dkt/config/test: New directory.
* lib/dkt/config/test/test_base.py: Add.
Added:
people/waldi/dkt/lib/dkt/config/test/
people/waldi/dkt/lib/dkt/config/test/test_base.py
Added: people/waldi/dkt/lib/dkt/config/test/test_base.py
==============================================================================
--- (empty file)
+++ people/waldi/dkt/lib/dkt/config/test/test_base.py Tue Jul 24 22:43:20 2007
@@ -0,0 +1,46 @@
+import py
+from dkt.config.base import *
+
+def test_get():
+ c = Config()
+ c._data = {'a': {'a': 'a'}}
+
+ assert c.get('a', 'a') == 'a'
+
+ py.test.raises(KeyError, c.get, 'a', 'b')
+ assert c.get('a', 'b', 'b') == 'b'
+
+ py.test.raises(KeyError, c.get, 'b', 'b')
+ assert c.get('b', 'b', 'b') == 'b'
+
+def test_get_section():
+ c = Config()
+ c._data = {'a': {'a': 'a'}}
+
+ assert c.get_section('a') == {'a': 'a'}
+
+ py.test.raises(KeyError, c.get_section, 'b')
+ assert c.get_section('b', 'b') == 'b'
+
+def test_options():
+ c = Config()
+ c._data = {'a': {'a': 'a'}}
+
+ assert c.options('a') == ['a']
+ py.test.raises(KeyError, c.options, 'b')
+
+def test_sections():
+ c = Config()
+ c._data = {'a': {'a': 'a'}}
+
+ assert c.sections() == ['a']
+
+def test_set():
+ c = MutableConfig()
+ c._data = {'a': {'a': 'a'}}
+
+ py.test.raises(KeyError, c.get, 'a', 'b')
+
+ c.set('a', 'b', 'c')
+
+ assert c.get('a', 'b') == 'c'
More information about the Kernel-svn-changes
mailing list