Add support for applying mutability on all sections of an INI configuration

This commit is contained in:
2026-03-15 23:37:05 +01:00
parent e8e5bddf51
commit da2e102343
4 changed files with 45 additions and 7 deletions
+30 -1
View File
@@ -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'