Compare commits

..

2 Commits

2 changed files with 4 additions and 4 deletions

View File

@ -54,10 +54,10 @@ class ConfigurationMultiDict(dict[str, Any]):
value(Any): value of the related key
Raises:
OptionError: if the key already exists in the dictionary, but not a single value list
OptionError: if the key already exists in the dictionary, but not a single value list or a string
"""
match self.get(key):
case [current_value]:
case [current_value] | str(current_value): # type: ignore[misc]
value = f"{current_value} {value}"
case None:
pass

View File

@ -40,9 +40,9 @@ def test_setitem_array_exception() -> None:
must raise exception if the current value is not a single value array
"""
instance = ConfigurationMultiDict()
instance["key[]"] = "value1"
instance["key[]"] = ["value1", "value2"]
with pytest.raises(OptionError):
instance["key[]"] = ["value2"]
instance["key[]"] = ["value3"]
def test_setitem_exception() -> None: