Add support for specifying mutability when parsing a configuration

This commit is contained in:
2026-03-15 23:10:15 +01:00
parent 264f8a0083
commit e46a9784bb
7 changed files with 64 additions and 10 deletions
+23 -1
View File
@@ -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'