mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-12 11:49:55 +00:00
Compare commits
2 Commits
6fe77eb465
...
b9900a14cd
Author | SHA1 | Date | |
---|---|---|---|
b9900a14cd | |||
9f11cafa22 |
@ -54,10 +54,10 @@ class ConfigurationMultiDict(dict[str, Any]):
|
|||||||
value(Any): value of the related key
|
value(Any): value of the related key
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
OptionError: if the key already exists in the dictionary, but not a single value list or a string
|
OptionError: if the key already exists in the dictionary, but not a single value list
|
||||||
"""
|
"""
|
||||||
match self.get(key):
|
match self.get(key):
|
||||||
case [current_value] | str(current_value): # type: ignore[misc]
|
case [current_value]:
|
||||||
value = f"{current_value} {value}"
|
value = f"{current_value} {value}"
|
||||||
case None:
|
case None:
|
||||||
pass
|
pass
|
||||||
|
@ -40,9 +40,9 @@ def test_setitem_array_exception() -> None:
|
|||||||
must raise exception if the current value is not a single value array
|
must raise exception if the current value is not a single value array
|
||||||
"""
|
"""
|
||||||
instance = ConfigurationMultiDict()
|
instance = ConfigurationMultiDict()
|
||||||
instance["key[]"] = ["value1", "value2"]
|
instance["key[]"] = "value1"
|
||||||
with pytest.raises(OptionError):
|
with pytest.raises(OptionError):
|
||||||
instance["key[]"] = ["value3"]
|
instance["key[]"] = ["value2"]
|
||||||
|
|
||||||
|
|
||||||
def test_setitem_exception() -> None:
|
def test_setitem_exception() -> None:
|
||||||
|
Reference in New Issue
Block a user