Merge lp:~configglue/configglue/schemaconfig-integration-fixes into lp:configglue/schemaconfig-integration

Proposed by Ricardo Kirkner
Status: Merged
Merged at revision: 26
Proposed branch: lp:~configglue/configglue/schemaconfig-integration-fixes
Merge into: lp:configglue/schemaconfig-integration
Diff against target: 78 lines (+24/-4)
3 files modified
configglue/inischema/glue.py (+2/-2)
tests/inischema/test_parsers.py (+10/-0)
tests/inischema/test_typed.py (+12/-2)
To merge this branch: bzr merge lp:~configglue/configglue/schemaconfig-integration-fixes
Reviewer Review Type Date Requested Status
John Lenton Approve
Review via email: mp+31836@code.launchpad.net

Description of the change

upped test coverage

To post a comment you must log in.
26. By Ricardo Kirkner

fixed failing unicode test

Revision history for this message
John Lenton (chipaca) wrote :

yay

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configglue/inischema/glue.py'
2--- configglue/inischema/glue.py 2010-08-04 22:39:36 +0000
3+++ configglue/inischema/glue.py 2010-08-05 13:02:41 +0000
4@@ -19,10 +19,10 @@
5 """
6 from __future__ import absolute_import
7
8+from configglue.pyschema import schemaconfigglue, ini2schema
9+
10 __all__ = ('configglue',)
11
12-from configglue.pyschema import schemaconfigglue, ini2schema
13-
14 def configglue(fileobj, *filenames, **kwargs):
15 args = kwargs.pop('args', None)
16 return schemaconfigglue(ini2schema(fileobj), argv=args)
17
18=== modified file 'tests/inischema/test_parsers.py'
19--- tests/inischema/test_parsers.py 2010-07-31 01:15:59 +0000
20+++ tests/inischema/test_parsers.py 2010-08-05 13:02:41 +0000
21@@ -33,5 +33,15 @@
22 for value in ('xyzzy', '', '-1', '0.', '0.1'):
23 self.assertRaises(ValueError, parsers.bool_parser, value)
24
25+ def test_bool_not_string(self):
26+ self.assertEqual(parsers.bool_parser(1), True)
27+
28+ def test_bool_is_None(self):
29+ self.assertEqual(parsers.bool_parser(None), False)
30+
31 def test_lines(self):
32 self.assertEqual(parsers.lines('abc\ndef'), ['abc', 'def'])
33+
34+ def test_lines_not_string(self):
35+ self.assertEqual(parsers.lines(42), 42)
36+
37
38=== modified file 'tests/inischema/test_typed.py'
39--- tests/inischema/test_typed.py 2010-07-31 01:15:59 +0000
40+++ tests/inischema/test_typed.py 2010-08-05 13:02:41 +0000
41@@ -56,9 +56,13 @@
42 quux = \xe1rbol
43 quux.parser = unicode
44 quux.parser.args = utf-8
45- ignore
46+ replace
47
48 thud.help = this is the help for thud
49+
50+woof.default = marker
51+woof.default.parser = some.parser
52+woof.parser = bool
53 '''
54 self.config = TypedConfigParser()
55 self.config.readfp(StringIO(self.config_string))
56@@ -90,6 +94,10 @@
57 def test_value_is_default_if_empty(self):
58 self.config.parse('xyzzy', 'foo')
59 self.assertEqual(self.config.get('xyzzy', 'foo').value, 1j)
60+ def test_parse_default_parser(self):
61+ self.config.add_parser('some.parser', some_parser)
62+ self.config.parse('xyzzy', 'woof')
63+ self.assertTrue(self.config.get('xyzzy', 'woof').value)
64 def test_parse_all_parses_all(self):
65 self.config.add_parser('some.parser', some_parser)
66 self.config.add_parser('more.parser', some_parser)
67@@ -102,8 +110,10 @@
68 ('baz2', None),
69 ('foo', 1j),
70 ('meep', u'\xe1rbol'),
71- ('quux', u'rbol'),
72+ ('quux', unicode('\xe1rbol', 'utf-8',
73+ 'replace')),
74 ('thud', None),
75+ ('woof', True),
76 ])])
77 def test_add_multiple_parsers(self):
78 self.config.add_parsers(('some.parser', some_parser),

Subscribers

People subscribed via source and target branches

to all changes: