Author: waldi
Date: Tue Aug 28 19:20:51 2007
New Revision: 9398

Log:
* lib/dkt/config/base.py: Remove internal options from complete sections.
* lib/dkt/config/test/test_file.py: Add.


Added:
   people/waldi/dkt/lib/dkt/config/test/test_file.py
Modified:
   people/waldi/dkt/lib/dkt/config/base.py

Modified: people/waldi/dkt/lib/dkt/config/base.py
==============================================================================
--- people/waldi/dkt/lib/dkt/config/base.py     (original)
+++ people/waldi/dkt/lib/dkt/config/base.py     Tue Aug 28 19:20:51 2007
@@ -34,7 +34,11 @@
             if default is _marker:
                 raise KeyError(section)
             return default
-        return s.copy()
+        ret = s.copy()
+        for key in s.iterkeys():
+            if key.startswith('__') and key.endswith('__'):
+                del ret[key]
+        return ret
 
     def iteroptions(self, section):
         return self._sections[section].iterkeys()

Added: people/waldi/dkt/lib/dkt/config/test/test_file.py
==============================================================================
--- (empty file)
+++ people/waldi/dkt/lib/dkt/config/test/test_file.py   Tue Aug 28 19:20:51 2007
@@ -0,0 +1,33 @@
+import py
+from dkt.config.file import *
+from cStringIO import StringIO
+
+config1 = r"""
+[a]
+a: b
+a-b: c
+
+[b:1]
+a1:b
+a2: b
+a3 :b
+a4 : b
+
+[b: 2]
+a:
+ b
+ c
+
+[b :3]
+
+[b : 4]
+"""
+
+c = Config(StringIO(config1))
+
+def test_a():
+    assert c.get_section('a') == {'a': 'b', 'a-b': 'c'}
+
+def test_sections():
+    assert c.sections() == ['a', 'b:1', 'b:2', 'b:3', 'b:4']
+

_______________________________________________
Kernel-svn-changes mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/kernel-svn-changes

Reply via email to