configglue team mailing list archive
-
configglue team
-
Mailing list archive
-
Message #00002
[Merge] lp:~configglue/configglue/schemaconfig-integration-fixes into lp:configglue/schemaconfig-integration
Ricardo Kirkner has proposed merging lp:~configglue/configglue/schemaconfig-integration-fixes into lp:configglue/schemaconfig-integration.
Requested reviews:
Configglue developers (configglue)
upped test coverage
--
https://code.launchpad.net/~configglue/configglue/schemaconfig-integration-fixes/+merge/31836
Your team Configglue developers is requested to review the proposed merge of lp:~configglue/configglue/schemaconfig-integration-fixes into lp:configglue/schemaconfig-integration.
=== modified file 'configglue/inischema/glue.py'
--- configglue/inischema/glue.py 2010-08-04 22:39:36 +0000
+++ configglue/inischema/glue.py 2010-08-05 12:17:41 +0000
@@ -19,10 +19,10 @@
"""
from __future__ import absolute_import
+from configglue.pyschema import schemaconfigglue, ini2schema
+
__all__ = ('configglue',)
-from configglue.pyschema import schemaconfigglue, ini2schema
-
def configglue(fileobj, *filenames, **kwargs):
args = kwargs.pop('args', None)
return schemaconfigglue(ini2schema(fileobj), argv=args)
=== modified file 'tests/inischema/test_parsers.py'
--- tests/inischema/test_parsers.py 2010-07-31 01:15:59 +0000
+++ tests/inischema/test_parsers.py 2010-08-05 12:17:41 +0000
@@ -33,5 +33,15 @@
for value in ('xyzzy', '', '-1', '0.', '0.1'):
self.assertRaises(ValueError, parsers.bool_parser, value)
+ def test_bool_not_string(self):
+ self.assertEqual(parsers.bool_parser(1), True)
+
+ def test_bool_is_None(self):
+ self.assertEqual(parsers.bool_parser(None), False)
+
def test_lines(self):
self.assertEqual(parsers.lines('abc\ndef'), ['abc', 'def'])
+
+ def test_lines_not_string(self):
+ self.assertEqual(parsers.lines(42), 42)
+
=== modified file 'tests/inischema/test_typed.py'
--- tests/inischema/test_typed.py 2010-07-31 01:15:59 +0000
+++ tests/inischema/test_typed.py 2010-08-05 12:17:41 +0000
@@ -59,6 +59,10 @@
ignore
thud.help = this is the help for thud
+
+woof.default = marker
+woof.default.parser = some.parser
+woof.parser = bool
'''
self.config = TypedConfigParser()
self.config.readfp(StringIO(self.config_string))
@@ -90,6 +94,10 @@
def test_value_is_default_if_empty(self):
self.config.parse('xyzzy', 'foo')
self.assertEqual(self.config.get('xyzzy', 'foo').value, 1j)
+ def test_parse_default_parser(self):
+ self.config.add_parser('some.parser', some_parser)
+ self.config.parse('xyzzy', 'woof')
+ self.assertTrue(self.config.get('xyzzy', 'woof').value)
def test_parse_all_parses_all(self):
self.config.add_parser('some.parser', some_parser)
self.config.add_parser('more.parser', some_parser)