configparser API cleanup: default values now sensible, slightly incompatible.
Backwards compatible alternative values possible as documented.
Done by Łukasz Langa, approved by Raymond and Fred.
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py
index 08a313a..4b2d2df 100644
--- a/Lib/test/test_cfgparser.py
+++ b/Lib/test/test_cfgparser.py
@@ -29,6 +29,7 @@
allow_no_value = False
delimiters = ('=', ':')
comment_prefixes = (';', '#')
+ inline_comment_prefixes = (';', '#')
empty_lines_in_values = True
dict_type = configparser._default_dict
strict = False
@@ -41,6 +42,7 @@
allow_no_value=self.allow_no_value,
delimiters=self.delimiters,
comment_prefixes=self.comment_prefixes,
+ inline_comment_prefixes=self.inline_comment_prefixes,
empty_lines_in_values=self.empty_lines_in_values,
dict_type=self.dict_type,
strict=self.strict,
@@ -812,6 +814,7 @@
class ConfigParserTestCaseNonStandardDelimiters(ConfigParserTestCase):
delimiters = (':=', '$')
comment_prefixes = ('//', '"')
+ inline_comment_prefixes = ('//', '"')
class ConfigParserTestCaseNonStandardDefaultSection(ConfigParserTestCase):
default_section = 'general'
@@ -888,10 +891,12 @@
class RawConfigParserTestCaseNonStandardDelimiters(RawConfigParserTestCase):
delimiters = (':=', '$')
comment_prefixes = ('//', '"')
+ inline_comment_prefixes = ('//', '"')
-class RawConfigParserTestSambaConf(BasicTestCase):
+class RawConfigParserTestSambaConf(CfgParserTestCaseClass):
config_class = configparser.RawConfigParser
- comment_prefixes = ('#', ';', '//', '----')
+ comment_prefixes = ('#', ';', '----')
+ inline_comment_prefixes = ('//',)
empty_lines_in_values = False
def test_reading(self):
@@ -1074,7 +1079,8 @@
class CompatibleTestCase(CfgParserTestCaseClass):
config_class = configparser.RawConfigParser
- comment_prefixes = configparser._COMPATIBLE
+ comment_prefixes = '#;'
+ inline_comment_prefixes = ';'
def test_comment_handling(self):
config_string = textwrap.dedent("""\