def test_parser_unicode(self): s = textwrap.dedent(""" [__main__] bar = zátrapa """) _, cg, _ = configglue(StringIO(s)) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def test_parser_unicode(self): s = textwrap.dedent(""" [__main__] bar = zátrapa bar.parser = unicode bar.parser.args = utf-8 """) _, cg, _ = configglue(StringIO(s)) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def glue_config(confs=confs, base=base): config_parser = ini2schema(open(base)) config_parser.read(confs) return config_parser
def test_parser_bool(self): s = "[__main__]\nbar = true\nbar.parser = bool \n" _, cg, _ = configglue(StringIO(s)) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def test_parser_none(self): s = "[__main__]\nbar = meeeeh\nbar.parser = none" _, cg, _ = configglue(StringIO(s), extra_parsers=[("none", str)]) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def test_main(self): s = "[__main__]\nbar = 42\n" _, cg, _ = configglue(StringIO(s)) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def test_empty(self): s = "" _, cg, _ = configglue(StringIO(s)) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))
def test_parser_none(self): s = "[__main__]\nbar = meeeeh\nbar.parser = none" _, cg, _ = configglue(StringIO(s), extra_parsers=[('none', str)]) _, sg, _ = schemaconfigglue(ini2schema(StringIO(s))) self.assertEqual(vars(cg), vars(sg))