mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2026-04-18 12:33:34 +00:00
refactor target
add error test for ValueError test badges updated patch bump
This commit is contained in:
@@ -10,14 +10,14 @@ class TestErrors:
|
||||
def test_it_tests_an_unknown_kind(self):
|
||||
with pytest.raises(
|
||||
voicemeeterlib.error.VMError,
|
||||
match=f"Unknown Voicemeeter kind 'unknown_kind'",
|
||||
match="Unknown Voicemeeter kind 'unknown_kind'",
|
||||
):
|
||||
voicemeeterlib.api("unknown_kind")
|
||||
|
||||
def test_it_tests_an_unknown_parameter(self):
|
||||
with pytest.raises(
|
||||
voicemeeterlib.error.CAPIError,
|
||||
match=f"VBVMR_SetParameterFloat returned -3",
|
||||
match="VBVMR_SetParameterFloat returned -3",
|
||||
) as exc_info:
|
||||
vm.set("unknown.parameter", 1)
|
||||
|
||||
@@ -25,9 +25,9 @@ class TestErrors:
|
||||
assert e.code == -3
|
||||
assert e.fn_name == "VBVMR_SetParameterFloat"
|
||||
|
||||
def test_it_tests_an_invalid_config(self):
|
||||
def test_it_tests_an_unknown_config_name(self):
|
||||
EXPECTED_MSG = (
|
||||
f"No config with name 'unknown' is loaded into memory",
|
||||
"No config with name 'unknown' is loaded into memory",
|
||||
f"Known configs: {list(vm.configs.keys())}",
|
||||
)
|
||||
with pytest.raises(voicemeeterlib.error.VMError) as exc_info:
|
||||
@@ -35,3 +35,13 @@ class TestErrors:
|
||||
|
||||
e = exc_info.value
|
||||
assert e.message == "\n".join(EXPECTED_MSG)
|
||||
|
||||
def test_it_tests_an_invalid_config_key(self):
|
||||
CONFIG = {
|
||||
"strip-0": {"A1": True, "B1": True, "gain": -6.0},
|
||||
"bus-0": {"mute": True, "eq": {"on": True}},
|
||||
"unknown-0": {"state": True},
|
||||
"vban-out-1": {"name": "streamname"},
|
||||
}
|
||||
with pytest.raises(ValueError, match="invalid config key 'unknown'"):
|
||||
vm.apply(CONFIG)
|
||||
|
||||
Reference in New Issue
Block a user