Add support for specifying mutability when parsing a configuration
This commit is contained in:
+23
-1
@@ -94,4 +94,26 @@ def test_mutability():
|
||||
del config.key
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
pass
|
||||
|
||||
configuration = '[section]\nkey=value'
|
||||
config = INIConfiguration.from_string(configuration)
|
||||
config.key1 = 'value1'
|
||||
|
||||
set_mutability(config, False)
|
||||
try:
|
||||
config.key2 = 'value2'
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
config = INIConfiguration.from_string(configuration, mutable = False)
|
||||
|
||||
try:
|
||||
config.key1 = 'value1'
|
||||
assert False, 'Expected TypeError'
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
set_mutability(config, True)
|
||||
config.key2 = 'value2'
|
||||
Reference in New Issue
Block a user