示例#1
0
 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))
示例#2
0
 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))
示例#3
0
def glue_config(confs=confs, base=base):
    config_parser = ini2schema(open(base))
    config_parser.read(confs)
    return config_parser
示例#4
0
 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))
示例#5
0
 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))
示例#6
0
 def test_main(self):
     s = "[__main__]\nbar = 42\n"
     _, cg, _ = configglue(StringIO(s))
     _, sg, _ = schemaconfigglue(ini2schema(StringIO(s)))
     self.assertEqual(vars(cg), vars(sg))
示例#7
0
 def test_empty(self):
     s = ""
     _, cg, _ = configglue(StringIO(s))
     _, sg, _ = schemaconfigglue(ini2schema(StringIO(s)))
     self.assertEqual(vars(cg), vars(sg))
示例#8
0
 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))
示例#9
0
 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))
示例#10
0
 def test_main(self):
     s = "[__main__]\nbar = 42\n"
     _, cg, _ = configglue(StringIO(s))
     _, sg, _ = schemaconfigglue(ini2schema(StringIO(s)))
     self.assertEqual(vars(cg), vars(sg))
示例#11
0
 def test_empty(self):
     s = ""
     _, cg, _ = configglue(StringIO(s))
     _, sg, _ = schemaconfigglue(ini2schema(StringIO(s)))
     self.assertEqual(vars(cg), vars(sg))