← Back to team overview

configglue team mailing list archive

[Merge] lp:~ricardokirkner/configglue/refactor-options-intoption into lp:configglue

 

Ricardo Kirkner has proposed merging lp:~ricardokirkner/configglue/refactor-options-intoption into lp:configglue with lp:~ricardokirkner/configglue/refactor-options-stringoption as a prerequisite.

Requested reviews:
  Configglue developers (configglue)

For more details, see:
https://code.launchpad.net/~ricardokirkner/configglue/refactor-options-intoption/+merge/64437
-- 
https://code.launchpad.net/~ricardokirkner/configglue/refactor-options-intoption/+merge/64437
Your team Configglue developers is requested to review the proposed merge of lp:~ricardokirkner/configglue/refactor-options-intoption into lp:configglue.
=== modified file 'configglue/inischema/glue.py'
--- configglue/inischema/glue.py	2011-06-13 18:47:23 +0000
+++ configglue/inischema/glue.py	2011-06-13 18:47:23 +0000
@@ -29,7 +29,7 @@
 from configglue.pyschema.schema import (
     BoolConfigOption,
     ConfigSection,
-    IntConfigOption,
+    IntOption,
     LinesConfigOption,
     Schema,
     StringOption,
@@ -59,7 +59,7 @@
     p.parse_all()
 
     parser2option = {'unicode': StringOption,
-                     'int': IntConfigOption,
+                     'int': IntOption,
                      'bool': BoolConfigOption,
                      'lines': LinesConfigOption}
 

=== modified file 'configglue/pyschema/schema.py'
--- configglue/pyschema/schema.py	2011-06-13 18:47:23 +0000
+++ configglue/pyschema/schema.py	2011-06-13 18:47:23 +0000
@@ -26,6 +26,7 @@
     'ConfigSection',
     'DictConfigOption',
     'IntConfigOption',
+    'IntOption',
     'LinesConfigOption',
     'Schema',
     'StringConfigOption',
@@ -314,7 +315,7 @@
         return isinstance(value, bool)
 
 
-class IntConfigOption(ConfigOption):
+class IntOption(ConfigOption):
     """A ConfigOption that is parsed into an int"""
 
     def _get_default(self):
@@ -591,3 +592,7 @@
 
 class StringConfigOption(StringOption):
     __metaclass__ = DeprecatedOption
+
+
+class IntConfigOption(IntOption):
+    __metaclass__ = DeprecatedOption

=== modified file 'doc/howto/custom-schema-options.rst'
--- doc/howto/custom-schema-options.rst	2011-06-13 18:47:23 +0000
+++ doc/howto/custom-schema-options.rst	2011-06-13 18:47:23 +0000
@@ -10,7 +10,7 @@
 The :doc:`schema reference </topics/schemas>` documentation explains how to
 use configglue's standard option classes --
 :class:`~configglue.pyschema.schema.BoolConfigOption`,
-:class:`~configglue.pyschema.schema.IntConfigOption`, etc. For many purposes,
+:class:`~configglue.pyschema.schema.IntOption`, etc. For many purposes,
 those classes are all you'll need. Sometimes, though, the configglue version
 won't meet your precise requirements, or you'll want to use a option that is
 entirely different from those shipped with configglue.

=== modified file 'doc/intro/quickstart.rst'
--- doc/intro/quickstart.rst	2011-04-21 02:42:18 +0000
+++ doc/intro/quickstart.rst	2011-06-13 18:47:23 +0000
@@ -28,7 +28,7 @@
 
         # create the schema
         class MySchema(pyschema.Schema):
-            foo = pyschema.IntConfigOption()
+            foo = pyschema.IntOption()
             bar = pyschema.BoolConfigOption()
 
         # read the configuration files
@@ -73,7 +73,7 @@
     ::
 
         class MySchema(pyschema.Schema):
-            foo = pyschema.IntConfigOption()
+            foo = pyschema.IntOption()
             bar = pyschema.BoolConfigOption()
 
 #. Create a parser for that schema
@@ -129,7 +129,7 @@
 
         # create the schema
         class MySchema(pyschema.Schema):
-            foo = pyschema.IntConfigOption()
+            foo = pyschema.IntOption()
             bar = pyschema.BoolConfigOption()
 
         # glue everything together

=== modified file 'doc/ref/schemas/options.rst'
--- doc/ref/schemas/options.rst	2011-06-13 18:47:23 +0000
+++ doc/ref/schemas/options.rst	2011-06-13 18:47:23 +0000
@@ -111,10 +111,10 @@
 
 A true/false option.
 
-``IntConfigOption``
+``IntOption``
 -------------------
 
-.. class:: IntConfigOption([**attributes])
+.. class:: IntOption([**attributes])
 
 An integer.
 

=== modified file 'doc/topics/config-file.rst'
--- doc/topics/config-file.rst	2011-06-13 18:47:23 +0000
+++ doc/topics/config-file.rst	2011-06-13 18:47:23 +0000
@@ -41,7 +41,7 @@
 Therefore, if you have a schema like::
 
     class MySchema(pyschema.Schema):
-        foo = IntConfigOption()
+        foo = IntOption()
 
 and you want to write a configuration file to match it, it would have to look
 like::
@@ -105,7 +105,7 @@
 
     class MySchema(pyschema.Schema):
         my_dict = pyschema.DictConfigOption(
-            spec={'foo': pyschema.IntConfigOption(),
+            spec={'foo': pyschema.IntOption(),
                   'bar': pyschema.BoolConfigOption()})
 
 `my_dict` would be parsed as::

=== modified file 'doc/topics/schemas.rst'
--- doc/topics/schemas.rst	2011-06-13 18:47:23 +0000
+++ doc/topics/schemas.rst	2011-06-13 18:47:23 +0000
@@ -28,7 +28,7 @@
         host = pyschema.StringOption(
             default='localhost',
             help='Host where the database engine is listening on')
-        port = pyschema.IntConfigOption(
+        port = pyschema.IntOption(
             default=5432,
             help='Port where the database engine is listening on')
         dbname = pyschema.StringOption(
@@ -51,8 +51,8 @@
 Example::
 
     class OvenSettings(pyschema.Schema):
-        temperature = pyschema.IntConfigOption()
-        time = pyschema.IntConfigOption()
+        temperature = pyschema.IntOption()
+        time = pyschema.IntOption()
 
 Option types
 ------------
@@ -106,7 +106,7 @@
     result in a Python syntax error. For example::
 
         class Example(pyschema.Schema):
-            pass = pyschema.IntConfigOption() # 'pass' is a reserved word!
+            pass = pyschema.IntOption() # 'pass' is a reserved word!
 
 Custom option types
 -------------------
@@ -150,15 +150,15 @@
 
 
     class BaseSchema(pyschema.Schema):
-        option1 = pyschema.IntConfigOption()
+        option1 = pyschema.IntOption()
         class section1(pyschema.ConfigSection):
             option1 = pyschema.BoolConfigOption()
 
 
     class ChildSchema(BaseSchema):
-        option2 = pyschema.IntConfigOption()
+        option2 = pyschema.IntOption()
         class section1(BaseSchema.section1):
-            option2 = IntConfigOption()
+            option2 = IntOption()
 
 In this example :class:`ChildSchema` will have two top-level options,
 :attr:`option1` and :attr:`option2`, and one section :attr:`section1`, which
@@ -170,11 +170,11 @@
     from configglue import pyschema
 
     class ChildSchema(pyschema.Schema):
-        option1 = pyschema.IntConfigOption()
-        option2 = pyschema.IntConfigOption()
+        option1 = pyschema.IntOption()
+        option2 = pyschema.IntOption()
         class section1(pyschema.ConfigSection):
             option1 = pyschema.BoolConfigOption()
-            option2 = IntConfigOption()
+            option2 = IntOption()
 
 
 Multiple inheritance

=== modified file 'tests/pyschema/test_parser.py'
--- tests/pyschema/test_parser.py	2011-06-13 18:47:23 +0000
+++ tests/pyschema/test_parser.py	2011-06-13 18:47:23 +0000
@@ -45,7 +45,7 @@
     BoolConfigOption,
     ConfigSection,
     DictConfigOption,
-    IntConfigOption,
+    IntOption,
     LinesConfigOption,
     Schema,
     StringOption,
@@ -117,9 +117,9 @@
             return config, folder
 
         class MySchema(Schema):
-            foo = IntConfigOption()
-            bar = IntConfigOption()
-            baz = IntConfigOption()
+            foo = IntOption()
+            bar = IntOption()
+            baz = IntOption()
 
         config, folder = setup_config()
         expected_values = {'__main__': {'foo': 1, 'bar': 2, 'baz': 3}}
@@ -154,9 +154,9 @@
             return config, folder
 
         class MySchema(Schema):
-            foo = IntConfigOption()
-            bar = IntConfigOption()
-            baz = IntConfigOption()
+            foo = IntOption()
+            bar = IntOption()
+            baz = IntOption()
 
         config, folder = setup_config()
         expected_values = {'__main__': {'foo': 4, 'bar': 2, 'baz': 3}}
@@ -228,10 +228,10 @@
     def test_interpolate_across_sections(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             class baz(ConfigSection):
-                wham = IntConfigOption()
+                wham = IntOption()
 
         config = StringIO("[foo]\nbar=%(wham)s\n[baz]\nwham=42")
         parser = SchemaConfigParser(MySchema())
@@ -242,10 +242,10 @@
     def test_interpolate_invalid_key(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             class baz(ConfigSection):
-                wham = IntConfigOption()
+                wham = IntOption()
 
         config = StringIO("[foo]\nbar=%(wham)s\n[baz]\nwham=42")
         parser = SchemaConfigParser(MySchema())
@@ -266,7 +266,7 @@
 
     def test_get_interpolation_keys_int(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
         config = StringIO("[__main__]\nfoo=%(bar)s")
         expected = ('%(bar)s', set(['bar']))
 
@@ -323,7 +323,7 @@
 
     def test_get_interpolation_keys_dict(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'a': IntConfigOption()})
+            foo = DictConfigOption(spec={'a': IntOption()})
         config = StringIO(textwrap.dedent("""
             [__noschema__]
             bar=4
@@ -390,7 +390,7 @@
 
     def test_interpolate_parse_dict(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'a': IntConfigOption()})
+            foo = DictConfigOption(spec={'a': IntOption()})
         config = StringIO(textwrap.dedent("""
             [__noschema__]
             bar=4
@@ -485,10 +485,10 @@
     def test_values_many_sections_same_option(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             class baz(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
         config = StringIO("[foo]\nbar=3\n[baz]\nbar=4")
         expected_values = {'foo': {'bar': 3}, 'baz': {'bar': 4}}
@@ -502,10 +502,10 @@
     def test_values_many_sections_different_options(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             class bar(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
 
         config = StringIO("[foo]\nbar=3\n[bar]\nbaz=4")
         expected_values = {'foo': {'bar': 3}, 'bar': {'baz': 4}}
@@ -537,7 +537,7 @@
             foo = BoolConfigOption(default=True)
 
             class bar(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
                 bla = StringOption(default='hello')
 
         schema = MySchema()
@@ -558,8 +558,8 @@
 
     def test_fatal_options(self):
         class MySchema(Schema):
-            foo = IntConfigOption(fatal=True)
-            bar = IntConfigOption()
+            foo = IntOption(fatal=True)
+            bar = IntOption()
         schema = MySchema()
         config = StringIO("[__main__]\nfoo=123")
         expected = {'__main__': {'foo': 123, 'bar': 0}}
@@ -574,7 +574,7 @@
 
     def test_extra_sections(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'bar': IntConfigOption()})
+            foo = DictConfigOption(spec={'bar': IntOption()})
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=1")
         parser = SchemaConfigParser(MySchema())
@@ -588,7 +588,7 @@
     def test_multiple_extra_sections(self):
         class MySchema(Schema):
             foo = LinesConfigOption(
-                item=DictConfigOption(spec={'bar': IntConfigOption()}))
+                item=DictConfigOption(spec={'bar': IntOption()}))
 
         config = StringIO('[__main__]\nfoo=d1\n    d2\n    d3\n'
                           '[d1]\nbar=1\n[d2]\nbar=2\n[d3]\nbar=3')
@@ -617,7 +617,7 @@
     def test_get_default_from_section(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
         config = StringIO("[__main__]\n")
         expected = 0
 
@@ -639,8 +639,8 @@
     def test_multi_file_dict_config(self):
         class MySchema(Schema):
             foo = DictConfigOption(spec={
-                'bar': IntConfigOption(),
-                'baz': IntConfigOption(),
+                'bar': IntOption(),
+                'baz': IntOption(),
             }, strict=True)
         config1 = StringIO('[__main__]\nfoo=mydict\n[mydict]\nbar=1\nbaz=1')
         config2 = StringIO('[mydict]\nbaz=2')
@@ -655,8 +655,8 @@
         class MySchema(Schema):
             foo = LinesConfigOption(
                 item=DictConfigOption(spec={
-                    'bar': IntConfigOption(),
-                    'baz': IntConfigOption(),
+                    'bar': IntOption(),
+                    'baz': IntOption(),
                 }, strict=True))
 
         config1 = StringIO('[__main__]\nfoo=mydict\n[mydict]\nbar=1\nbaz=1')
@@ -746,7 +746,7 @@
 
     def test_set_non_string(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
             bar = BoolConfigOption()
         parser = SchemaConfigParser(MySchema())
         parser.parse_all()
@@ -863,7 +863,7 @@
 
     def test_basic_is_valid(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         schema = MySchema()
         config = StringIO("[__main__]\nfoo = 5")
@@ -874,7 +874,7 @@
 
     def test_basic_is_valid_with_report(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         config = StringIO("[__main__]\nfoo=5")
         expected = (True, [])
@@ -885,7 +885,7 @@
 
     def test_basic_is_not_valid(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         schema = MySchema()
         config = StringIO("[__main__]\nfoo = 5\nbar = 6")
@@ -896,7 +896,7 @@
 
     def test_basic_is_not_valid_with_report(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         config = StringIO("[__main__]\nfoo=5\nbar=6")
         errors = ["Configuration includes invalid options for "
@@ -910,7 +910,7 @@
 
     def test_is_not_valid_parser_error(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         def mock_parse_all(self):
             assert False
@@ -946,8 +946,8 @@
 
     def test_missing_fatal_options(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
-            bar = IntConfigOption(fatal=True)
+            foo = IntOption()
+            bar = IntOption(fatal=True)
 
         config = StringIO("[__main__]\nfoo=1")
         parser = SchemaConfigParser(MySchema())
@@ -957,8 +957,8 @@
 
     def test_missing_nonfatal_options(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
-            bar = IntConfigOption(fatal=True)
+            foo = IntOption()
+            bar = IntOption(fatal=True)
 
         config = StringIO("[__main__]\nbar=2")
         parser = SchemaConfigParser(MySchema())
@@ -968,7 +968,7 @@
 
     def test_extra_sections(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'bar': IntConfigOption()})
+            foo = DictConfigOption(spec={'bar': IntOption()})
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=1")
         parser = SchemaConfigParser(MySchema())
@@ -1108,7 +1108,7 @@
     def test_multiple_extra_sections(self):
         class MySchema(Schema):
             foo = LinesConfigOption(
-                item=DictConfigOption(spec={'bar': IntConfigOption()}))
+                item=DictConfigOption(spec={'bar': IntOption()}))
 
         config = StringIO('[__main__]\nfoo=d1\n    d2\n    d3\n'
                           '[d1]\nbar=1\n[d2]\nbar=2\n[d3]\nbar=3')

=== modified file 'tests/pyschema/test_schema.py'
--- tests/pyschema/test_schema.py	2011-06-13 18:47:23 +0000
+++ tests/pyschema/test_schema.py	2011-06-13 18:47:23 +0000
@@ -26,6 +26,7 @@
     ConfigSection,
     DictConfigOption,
     IntConfigOption,
+    IntOption,
     LinesConfigOption,
     Schema,
     StringConfigOption,
@@ -42,13 +43,13 @@
 
         class MyOtherSchema(Schema):
             class web(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             class froo(ConfigSection):
                 twaddle = LinesConfigOption(item=BoolConfigOption())
 
         class MyThirdSchema(Schema):
-            bar = IntConfigOption()
+            bar = IntOption()
 
             class froo(ConfigSection):
                 twaddle = LinesConfigOption(item=BoolConfigOption())
@@ -85,7 +86,7 @@
             foo = BoolConfigOption()
 
             class bar(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
 
         schema = MySchema()
         self.assertEquals('foo', schema.foo.name)
@@ -99,7 +100,7 @@
             foo = BoolConfigOption()
 
             class bar(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
 
         schema = MySchema()
         names = set(s.name for s in schema.options())
@@ -115,10 +116,10 @@
 
     def test_equal(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         class OtherSchema(Schema):
-            bar = IntConfigOption()
+            bar = IntOption()
 
         self.assertEqual(MySchema(), MySchema())
         self.assertNotEqual(MySchema(), OtherSchema())
@@ -127,13 +128,13 @@
 class TestSchemaHelpers(unittest.TestCase):
     def test_get_config_objects(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
             class one(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
             two = ConfigSection()
-            two.bam = IntConfigOption()
+            two.bam = IntOption()
 
         expected = {
             'foo': MySchema.foo,
@@ -150,8 +151,8 @@
 
 class TestConfigOption(unittest.TestCase):
     def test_equal(self):
-        opt1 = IntConfigOption(name='opt1')
-        opt2 = IntConfigOption(name='opt2')
+        opt1 = IntOption(name='opt1')
+        opt2 = IntOption(name='opt2')
         opt3 = StringOption(name='opt1')
         self.assertEqual(opt1, opt1)
         self.assertNotEqual(opt1, opt2)
@@ -160,8 +161,8 @@
     def test_equal_when_in_section(self):
         sect1 = ConfigSection(name='sect1')
         sect2 = ConfigSection(name='sect2')
-        opt1 = IntConfigOption()
-        opt2 = IntConfigOption()
+        opt1 = IntOption()
+        opt2 = IntOption()
 
         self.assertEqual(opt1, opt2)
 
@@ -170,8 +171,8 @@
         self.assertNotEqual(opt1, opt2)
 
     def test_equal_when_error(self):
-        opt1 = IntConfigOption()
-        opt2 = IntConfigOption()
+        opt1 = IntOption()
+        opt2 = IntOption()
 
         # make sure an attribute error is raised
         del opt2.name
@@ -186,15 +187,15 @@
     def setUp(self):
         class SchemaA(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
         class SchemaB(SchemaA):
             class baz(ConfigSection):
-                wham = IntConfigOption()
+                wham = IntOption()
 
         class SchemaC(SchemaA):
             class bar(ConfigSection):
-                woof = IntConfigOption()
+                woof = IntOption()
 
         self.schema = SchemaB()
         self.other = SchemaC()
@@ -206,7 +207,7 @@
             self.assertTrue(isinstance(section_obj, ConfigSection))
             for option in options:
                 option_obj = getattr(section_obj, option)
-                self.assertTrue(isinstance(option_obj, IntConfigOption))
+                self.assertTrue(isinstance(option_obj, IntOption))
 
     def test_inherited_sections(self):
         names = set(s.name for s in self.schema.sections())
@@ -218,7 +219,7 @@
 
     def test_mutable_inherited(self):
         # modify one inherited attribute
-        self.schema.foo.baz = IntConfigOption()
+        self.schema.foo.baz = IntOption()
 
         # test on the other schema
         self.assertFalse(hasattr(self.other.foo, 'baz'))
@@ -226,13 +227,13 @@
     def test_merge_inherited(self):
         class SchemaA(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
-            bar = IntConfigOption()
+            bar = IntOption()
 
         class SchemaB(SchemaA):
             class foo(SchemaA.foo):
-                baz = IntConfigOption()
+                baz = IntOption()
 
         # SchemaB inherits attributes from SchemaA and merges its own
         # attributes into
@@ -314,10 +315,12 @@
     cls = StringConfigOption
 
 
-class TestIntConfigOption(unittest.TestCase):
+class TestIntOption(unittest.TestCase):
+    cls = IntOption
+
     def test_parse_int(self):
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = self.cls()
 
         config = StringIO("[__main__]\nfoo = 42")
         expected_values = {'__main__': {'foo': 42}}
@@ -337,18 +340,22 @@
         self.assertRaises(ValueError, parser.values)
 
     def test_default(self):
-        opt = IntConfigOption()
+        opt = self.cls()
         self.assertEqual(opt.default, 0)
 
     def test_validate_int(self):
-        opt = IntConfigOption()
+        opt = self.cls()
         self.assertEqual(opt.validate(0), True)
 
     def test_validate_nonint(self):
-        opt = IntConfigOption()
+        opt = self.cls()
         self.assertEqual(opt.validate(''), False)
 
 
+class TestIntConfigOption(TestIntOption):
+    cls = IntConfigOption
+
+
 class TestBoolConfigOption(unittest.TestCase):
     def test_parse_bool(self):
         class MySchema(Schema):
@@ -392,7 +399,7 @@
 class TestLinesConfigOption(unittest.TestCase):
     def test_parse_int_lines(self):
         class MySchema(Schema):
-            foo = LinesConfigOption(item=IntConfigOption())
+            foo = LinesConfigOption(item=IntOption())
 
         config = StringIO("[__main__]\nfoo = 42\n 43\n 44")
         expected_values = {'__main__': {'foo': [42, 43, 44]}}
@@ -439,7 +446,7 @@
         self.assertRaises(ValueError, parser.values)
 
     def test_default(self):
-        opt = LinesConfigOption(item=IntConfigOption())
+        opt = LinesConfigOption(item=IntOption())
         self.assertEqual(opt.default, [])
 
     def test_remove_duplicates(self):
@@ -467,11 +474,11 @@
                           parser.values())
 
     def test_validate_list(self):
-        opt = LinesConfigOption(item=IntConfigOption())
+        opt = LinesConfigOption(item=IntOption())
         self.assertEqual(opt.validate([]), True)
 
     def test_validate_nonlist(self):
-        opt = LinesConfigOption(item=IntConfigOption())
+        opt = LinesConfigOption(item=IntOption())
         self.assertEqual(opt.validate(''), False)
 
 
@@ -535,7 +542,7 @@
         self.assertEqual(opt.spec, {})
         self.assertEqual(opt.strict, False)
 
-        spec = {'a': IntConfigOption(), 'b': BoolConfigOption()}
+        spec = {'a': IntOption(), 'b': BoolConfigOption()}
         opt = DictConfigOption(spec=spec)
         self.assertEqual(opt.spec, spec)
         self.assertEqual(opt.strict, False)
@@ -568,7 +575,7 @@
         class MySchema(Schema):
             foo = DictConfigOption(spec={
                 'bar': StringOption(),
-                'baz': IntConfigOption(),
+                'baz': IntOption(),
                 'bla': BoolConfigOption(),
             })
 
@@ -592,7 +599,7 @@
         class MySchema(Schema):
             foo = DictConfigOption(spec={
                 'bar': StringOption(),
-                'baz': IntConfigOption(),
+                'baz': IntOption(),
                 'bla': BoolConfigOption(),
             })
 
@@ -611,7 +618,7 @@
 
     def test_parse_invalid_key_in_parsed(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'bar': IntConfigOption()})
+            foo = DictConfigOption(spec={'bar': IntOption()})
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbaz=2")
         expected_values = {'__main__': {'foo': {'bar': 0, 'baz': '2'}}}
@@ -622,8 +629,8 @@
     def test_parse_invalid_key_in_spec(self):
         class MySchema(Schema):
             foo = DictConfigOption(spec={
-                'bar': IntConfigOption(),
-                'baz': IntConfigOption(fatal=True)})
+                'bar': IntOption(),
+                'baz': IntOption(fatal=True)})
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=2")
         parser = SchemaConfigParser(MySchema())
@@ -636,7 +643,7 @@
 
     def test_parse_no_strict_missing_args(self):
         class MySchema(Schema):
-            foo = DictConfigOption(spec={'bar': IntConfigOption()})
+            foo = DictConfigOption(spec={'bar': IntOption()})
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]")
         expected_values = {'__main__': {'foo': {'bar': 0}}}
@@ -658,7 +665,7 @@
         class MySchema(Schema):
             foo = DictConfigOption(
                       item=DictConfigOption(
-                          item=IntConfigOption()))
+                          item=IntOption()))
         config = StringIO("""
 [__main__]
 foo = mydict
@@ -674,7 +681,7 @@
 
     def test_parse_strict(self):
         class MySchema(Schema):
-            spec = {'bar': IntConfigOption()}
+            spec = {'bar': IntOption()}
             foo = DictConfigOption(spec=spec, strict=True)
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=2")
@@ -685,8 +692,8 @@
 
     def test_parse_strict_missing_vars(self):
         class MySchema(Schema):
-            spec = {'bar': IntConfigOption(),
-                    'baz': IntConfigOption()}
+            spec = {'bar': IntOption(),
+                    'baz': IntOption()}
             foo = DictConfigOption(spec=spec, strict=True)
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=2")
@@ -697,7 +704,7 @@
 
     def test_parse_strict_extra_vars(self):
         class MySchema(Schema):
-            spec = {'bar': IntConfigOption()}
+            spec = {'bar': IntOption()}
             foo = DictConfigOption(spec=spec, strict=True)
 
         config = StringIO("[__main__]\nfoo=mydict\n[mydict]\nbar=2\nbaz=3")
@@ -720,7 +727,7 @@
             foo = LinesConfigOption(item=DictConfigOption(
                 spec={
                     'bar': StringOption(),
-                    'baz': IntConfigOption(),
+                    'baz': IntOption(),
                     'bla': BoolConfigOption(),
                 }))
 
@@ -750,11 +757,11 @@
 class TestDictWithDicts(unittest.TestCase):
     def test_parse_dict_with_dicts(self):
         innerspec = {'bar': StringOption(),
-                     'baz': IntConfigOption(),
+                     'baz': IntOption(),
                      'bla': BoolConfigOption(),
                     }
         spec = {'name': StringOption(),
-                'size': IntConfigOption(),
+                'size': IntOption(),
                 'options': DictConfigOption(spec=innerspec)}
 
         class MySchema(Schema):
@@ -821,7 +828,7 @@
         section2 = self.cls()
         section3 = self.cls(name='foo')
         section4 = self.cls()
-        section4.foo = IntConfigOption()
+        section4.foo = IntOption()
 
         self.assertEqual(section1, section1)
         self.assertEqual(section1, section2)
@@ -837,7 +844,7 @@
 
     def test_has_option(self):
         section = self.cls()
-        section.foo = IntConfigOption()
+        section.foo = IntOption()
         section.bar = 4
 
         self.assertEqual(section.has_option('foo'), True)
@@ -845,14 +852,14 @@
 
     def test_option(self):
         section = self.cls()
-        section.foo = IntConfigOption()
+        section.foo = IntOption()
 
         self.assertEqual(section.option('foo'), section.foo)
         self.assertRaises(AssertionError, section.option, 'bar')
 
     def test_options(self):
         section = self.cls()
-        section.foo = IntConfigOption()
+        section.foo = IntOption()
         section.bar = 4
 
         self.assertEqual(section.options(), [section.foo])

=== modified file 'tests/pyschema/test_schemaconfig.py'
--- tests/pyschema/test_schemaconfig.py	2011-06-13 18:47:23 +0000
+++ tests/pyschema/test_schemaconfig.py	2011-06-13 18:47:23 +0000
@@ -30,7 +30,7 @@
 from configglue.pyschema.schema import (
     ConfigOption,
     ConfigSection,
-    IntConfigOption,
+    IntOption,
     Schema,
     StringOption,
 )
@@ -98,7 +98,7 @@
 
     def test_has_option(self):
         class sec1(ConfigSection):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         sec1 = sec1()
         self.assertTrue(sec1.has_option('foo'))
@@ -109,9 +109,9 @@
     def setUp(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                bar = IntConfigOption()
+                bar = IntOption()
 
-            baz = IntConfigOption(help='The baz option')
+            baz = IntOption(help='The baz option')
 
         self.parser = SchemaConfigParser(MySchema())
 
@@ -154,10 +154,10 @@
     def test_ambiguous_option(self):
         class MySchema(Schema):
             class foo(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
 
             class bar(ConfigSection):
-                baz = IntConfigOption()
+                baz = IntOption()
 
         config = StringIO("[foo]\nbaz=1")
         parser = SchemaConfigParser(MySchema())
@@ -220,7 +220,7 @@
 
         # define the inputs
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         configs = ['config.ini']
 
@@ -255,7 +255,7 @@
 
         # define the inputs
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         configs = ['config.ini']
 
@@ -292,7 +292,7 @@
 
         # define the inputs
         class MySchema(Schema):
-            foo = IntConfigOption()
+            foo = IntOption()
 
         configs = ['config.ini']
 


Follow ups