def test_readline_configparser(self): for s in self.test_strings: fp = OnlyReadline(s) c = compat.ConfigParser() c.readfp(fp) ss = StringIO() c.write(ss) self.assertEqual(s, ss.getvalue())
def test_assignment(self): c = compat.ConfigParser() c.optionxform = str c.add_section('foo') c.set('foo', 'bar', 'a') c.set('foo', 'Bar', 'b') self.assertEqual(c.get('foo', 'bar'), 'a') self.assertEqual(c.get('foo', 'Bar'), 'b')
def test_dyanamic(self): c = compat.ConfigParser() c.optionxform = str c.add_section('foo') c.set('foo', 'bar', 'a') c.set('foo', 'Bar', 'b') c.set('foo', 'BAR', 'c') c.optionxform = str.upper self.assertEqual(c.get('foo', 'Bar'), 'c') c.optionxform = str.lower self.assertEqual(c.get('foo', 'Bar'), 'a') c.optionxform = str self.assertEqual(c.get('foo', 'Bar'), 'b')