summaryrefslogtreecommitdiff
path: root/test_configobj.py
diff options
context:
space:
mode:
authorfuzzyman <devnull@localhost>2009-11-22 00:26:51 +0000
committerfuzzyman <devnull@localhost>2009-11-22 00:26:51 +0000
commitd9b3ecc236db2554482a88bc9502d95d983c6765 (patch)
treed9a801bf206c548ef0db41b7b546db84ddc928e5 /test_configobj.py
parentb59bb23a1c50862cb8e299f5afec2bf2068e8ce4 (diff)
downloadconfigobj-d9b3ecc236db2554482a88bc9502d95d983c6765.tar.gz
Fixed problem with missing sections and preserve_errors with validation.
Diffstat (limited to 'test_configobj.py')
-rw-r--r--test_configobj.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/test_configobj.py b/test_configobj.py
index dbdc712..7331aa8 100644
--- a/test_configobj.py
+++ b/test_configobj.py
@@ -1535,21 +1535,22 @@ def _test_validate():
>>> for entry in flatten_errors(cfg, res):
... section_list, key, error = entry
... section_list.insert(0, '[root]')
- ... section_list.append(key)
+ ... if key is not None:
+ ... section_list.append(key)
... section_string = ', '.join(section_list)
- ... errors.append((section_string, ' = ', error or 'missing'))
+ ... errors.append('%s%s%s' % (section_string, ' = ', error or 'missing'))
>>> errors.sort()
>>> for entry in errors:
- ... print entry[0], entry[1], entry[2]
- [root], option2 = missing
- [root], option3 = the value "Bad_value" is of the wrong type.
- [root], section1, option2 = missing
- [root], section1, option3 = the value "Bad_value" is of the wrong type.
- [root], section2, another_option = the value "Probably" is of the wrong type.
- [root], section3, section3b, section3b-sub, value = missing
- [root], section3, section3b, value2 = the value "a" is of the wrong type.
- [root], section3, section3b, value3 = the value "11" is too big.
- [root], section4, another_option = missing
+ ... print entry
+ [root], option2 = missing
+ [root], option3 = the value "Bad_value" is of the wrong type.
+ [root], section1, option2 = missing
+ [root], section1, option3 = the value "Bad_value" is of the wrong type.
+ [root], section2, another_option = the value "Probably" is of the wrong type.
+ [root], section3, section3b, section3b-sub = missing
+ [root], section3, section3b, value2 = the value "a" is of the wrong type.
+ [root], section3, section3b, value3 = the value "11" is too big.
+ [root], section4 = missing
"""
@@ -2110,7 +2111,7 @@ def _test_validation_with_preserve_errors():
>>> spec = ['[section]', 'foo = integer']
>>> c = ConfigObj(configspec=spec)
>>> c.validate(v, preserve_errors=True)
- False
+ {'section': False}
>>> c = ConfigObj(['[section]'], configspec=spec)
>>> c.validate(v)
False