mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-04 15:59:55 +00:00
Compare commits
2 Commits
b9900a14cd
...
6fe77eb465
Author | SHA1 | Date | |
---|---|---|---|
6fe77eb465 | |||
7c6c24a46d |
@ -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
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user