예제 #1
0
 def testLoadsStrictFailure(self):
     ini_str = textwrap.dedent("""\
     foo.bar = 1
     foo.baz = example
     bar.bad = /path/to/thing
     foo.bar = duplicate
     """)
     with self.assertRaises(ValueError):
         ini.loads(ini_str, strict=True)
예제 #2
0
 def testLoadsBasic(self):
     ini_str = textwrap.dedent("""\
     foo.bar = 1
     foo.baz= example
     bar.bad =/path/to/thing
     """)
     expected = {
         'foo.bar': '1',
         'foo.baz': 'example',
         'bar.bad': '/path/to/thing',
     }
     self.assertEqual(expected, ini.loads(ini_str))
예제 #3
0
 def testLoadsPermissive(self):
     ini_str = textwrap.dedent("""\
     foo.bar = 1
     foo.baz = example
     bar.bad = /path/to/thing
     foo.bar = duplicate
     """)
     expected = {
         'foo.bar': 'duplicate',
         'foo.baz': 'example',
         'bar.bad': '/path/to/thing',
     }
     self.assertEqual(expected, ini.loads(ini_str, strict=False))