Add support for applying mutability on all sections of an INI configuration
This commit is contained in:
+30
-1
@@ -116,4 +116,33 @@ def test_mutability():
|
||||
pass
|
||||
|
||||
set_mutability(config, True)
|
||||
config.key2 = 'value2'
|
||||
config.key2 = 'value2'
|
||||
|
||||
config = INIConfiguration.from_string(configuration, mutable = False)
|
||||
try:
|
||||
config.section.key1 = 'value1'
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
set_mutability(config.section, True)
|
||||
config.section.key2 = 'value2'
|
||||
|
||||
try:
|
||||
config.section1 = INIConfigurationSection('section1')
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
config = INIConfiguration()
|
||||
config.section = INIConfigurationSection('section', mutable = False)
|
||||
|
||||
try:
|
||||
config.section.key1 = 'value1'
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
set_mutability(config.section, True)
|
||||
config.section.key1 = 'value1'
|
||||
Reference in New Issue
Block a user