diff options
author | Łukasz Langa <lukasz@langa.pl> | 2010-11-21 13:56:42 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2010-11-21 13:56:42 (GMT) |
commit | a73dc9d5e8ba2320a5aebf8c24ab665ccdfed5f8 (patch) | |
tree | a3ac90c85ad5c002f030a052f1f3b3ad34bb2994 /Lib/test/test_cfgparser.py | |
parent | 5c86339bd09959366fcb0d4c31798a4aac128083 (diff) | |
download | cpython-a73dc9d5e8ba2320a5aebf8c24ab665ccdfed5f8.zip cpython-a73dc9d5e8ba2320a5aebf8c24ab665ccdfed5f8.tar.gz cpython-a73dc9d5e8ba2320a5aebf8c24ab665ccdfed5f8.tar.bz2 |
configparser: read-only attributes to get the section name and parser from a SectionProxy instance
Diffstat (limited to 'Lib/test/test_cfgparser.py')
-rw-r--r-- | Lib/test/test_cfgparser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py index 4faf90c..fc8b2ad 100644 --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -135,8 +135,15 @@ class BasicTestCase(CfgParserTestCaseClass): # mapping access eq(cf['Foo Bar']['foo'], 'bar1') eq(cf['Spacey Bar']['foo'], 'bar2') - eq(cf['Spacey Bar From The Beginning']['foo'], 'bar3') - eq(cf['Spacey Bar From The Beginning']['baz'], 'qwe') + section = cf['Spacey Bar From The Beginning'] + eq(section.name, 'Spacey Bar From The Beginning') + self.assertIs(section.parser, cf) + with self.assertRaises(AttributeError): + section.name = 'Name is read-only' + with self.assertRaises(AttributeError): + section.parser = 'Parser is read-only' + eq(section['foo'], 'bar3') + eq(section['baz'], 'qwe') eq(cf['Commented Bar']['foo'], 'bar4') eq(cf['Commented Bar']['baz'], 'qwe') eq(cf['Spaces']['key with spaces'], 'value') |