def test_circle(self) : changed_ini = dict(self.params_init) changed_ini['a'] = 15 parse_ini.write_params(changed_ini, 'temp.ini', prefix='tt_') read_ini = parse_ini.parse('temp.ini', self.params_init, prefix='tt_') self.assertEqual(read_ini['a'], 15) self.assertEqual(read_ini['b'], 10) os.remove('temp.ini')
def test_prefix(self) : out_dict, undeclared = parse_ini.parse(self.prefixed_ini_dict, self.params_init, prefix='tt_', return_undeclared=True) self.assertEqual(out_dict['a_string'], 'string') self.assertEqual(out_dict['a'], 1) self.assertEqual(out_dict['b'], 10) self.assertAlmostEqual(out_dict['pi'], 3.14159) self.assertEqual(undeclared['b'], 2) self.assertEqual(undeclared['tt_d'], 3)
def test_circle(self) : changed_ini = dict(test_ini_dict) changed_ini['a_string'] = 'a different string' changed_ini['a'] = 5 changed_ini['a_list'] = [5,6,7] copy_changed = dict(changed_ini) parse_ini.write_params(changed_ini, 'temp.ini') read_ini = parse_ini.parse('temp.ini', test_ini_dict) os.remove('temp.ini') for key, value in copy_changed.iteritems() : self.assertTrue(read_ini.has_key(key)) self.assertEqual(value, read_ini[key]) self.assertEqual(value, changed_ini[key])
def test_parse_file_undeclared(self) : self.out_dict, self.undeclared = parse_ini.parse(test_ini_file_name, self.template_dict, return_undeclared=True)
def test_parse_file_defaults(self) : self.out_dict = parse_ini.parse(test_ini_file_name, self.template_dict)
def test_parse_dict_defaults(self) : self.out_dict = parse_ini.parse(test_ini_dict, self.template_dict)
def test_defaults_None_ini(self) : self.out_dict = parse_ini.parse(None, test_ini_dict, return_undeclared=False)
def test_parse_readsdict(self) : self.out_dict = parse_ini.parse(test_ini_dict, self.template_dict, return_undeclared=False)
def test_parse_readsfile(self) : self.out_dict = parse_ini.parse(test_ini_file_name, self.template_dict, return_undeclared=False)