diff options
author | Łukasz Langa <lukasz@langa.pl> | 2010-12-17 01:32:29 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2010-12-17 01:32:29 (GMT) |
commit | b25a791802a1915097e02bfba04e27a41ae55ebf (patch) | |
tree | 67ed431421efd15f08d7b945d752549c7227f8f9 /Lib/test/test_cfgparser.py | |
parent | ed16bf4aaadd3deaedac8ee36753857b6b8a3492 (diff) | |
download | cpython-b25a791802a1915097e02bfba04e27a41ae55ebf.zip cpython-b25a791802a1915097e02bfba04e27a41ae55ebf.tar.gz cpython-b25a791802a1915097e02bfba04e27a41ae55ebf.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_cfgparser.py')
-rw-r--r-- | Lib/test/test_cfgparser.py | 12 |
1 files changed, 9 insertions, 3 deletions
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 @@ class CfgParserTestCaseClass(unittest.TestCase): 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 @@ class CfgParserTestCaseClass(unittest.TestCase): 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 ConfigParserTestCaseLegacyInterpolation(ConfigParserTestCase): class ConfigParserTestCaseNonStandardDelimiters(ConfigParserTestCase): delimiters = (':=', '$') comment_prefixes = ('//', '"') + inline_comment_prefixes = ('//', '"') class ConfigParserTestCaseNonStandardDefaultSection(ConfigParserTestCase): default_section = 'general' @@ -888,10 +891,12 @@ class RawConfigParserTestCase(BasicTestCase): 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 SortedTestCase(RawConfigParserTestCase): 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("""\ |