def test01_lists(self): """ Reading of lists with several elements """ list1 = ["first_element", 8, False, 0.21444] list2 = ["12.52.12.1", 4144] def repr_list(values): """ Returns a string representation of list. String values are stripped and all commas are removed. @param values: list to convert @type values: list or tuple @return: list formatted as string @rtype: str """ return ", ".join([str(v).replace("'","").replace('"','').strip() for v in values]) body = "[main]\nlist1 = %s\nlist2 = %s" content = body % (repr_list(list1), repr_list(list2)) t_file = tempfile.NamedTemporaryFile(mode="w", delete=False) t_file.write(content) t_file.close() config = ExtendedConfigParser() config.read(t_file.name) self.assertEqual(list1, config.getlist("main", "list1")) self.assertEqual(list2, config.getlist("main", "list2")) os.unlink(t_file.name)