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)
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))
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))