mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2025-04-03 20:33:44 +01:00
Compare commits
3 Commits
708a7e6d8e
...
e38922d8a0
Author | SHA1 | Date | |
---|---|---|---|
e38922d8a0 | |||
96f3faae28 | |||
bd57f78e8f |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 155"><title>tests: 155</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">155</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">155</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 158"><title>tests: 158</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">158</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">158</text></g></svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 112"><title>tests: 112</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">112</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">112</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 115"><title>tests: 115</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">115</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">115</text></g></svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 164"><title>tests: 164</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">164</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">164</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 183"><title>tests: 183</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">183</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">183</text></g></svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -12,37 +12,37 @@ class TestUserConfigs:
|
||||
def setup_class(cls):
|
||||
vm.apply_config("example")
|
||||
|
||||
def test_it_vm_config_string(self):
|
||||
def test_it_tests_vm_config_string(self):
|
||||
assert "PhysStrip" in vm.strip[data.phys_in].label
|
||||
assert "VirtStrip" in vm.strip[data.virt_in].label
|
||||
assert "PhysBus" in vm.bus[data.phys_out].label
|
||||
assert "VirtBus" in vm.bus[data.virt_out].label
|
||||
|
||||
def test_it_vm_config_bool(self):
|
||||
def test_it_tests_vm_config_bool(self):
|
||||
assert vm.strip[0].A1 == True
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name != "potato",
|
||||
reason="Skip test if kind is not potato",
|
||||
)
|
||||
def test_it_vm_config_bool_strip_eq_on(self):
|
||||
def test_it_tests_vm_config_bool_strip_eq_on(self):
|
||||
assert vm.strip[data.phys_in].eq.on == True
|
||||
|
||||
@pytest.mark.skipif(
|
||||
data.name != "banana",
|
||||
reason="Skip test if kind is not banana",
|
||||
)
|
||||
def test_it_vm_config_bool_bus_eq_ab(self):
|
||||
def test_it_tests_vm_config_bool_bus_eq_ab(self):
|
||||
assert vm.bus[data.phys_out].eq.ab == True
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"not config.getoption('--run-slow')",
|
||||
reason="Only run when --run-slow is given",
|
||||
)
|
||||
def test_it_vm_config_busmode(self):
|
||||
def test_it_tests_vm_config_busmode(self):
|
||||
assert vm.bus[data.phys_out].mode.get() == "composite"
|
||||
|
||||
def test_it_vm_config_bass_med_high(self):
|
||||
def test_it_tests_vm_config_bass_med_high(self):
|
||||
assert vm.strip[data.virt_in].bass == -3.2
|
||||
assert vm.strip[data.virt_in].mid == 1.5
|
||||
assert vm.strip[data.virt_in].high == 2.1
|
||||
|
37
tests/test_errors.py
Normal file
37
tests/test_errors.py
Normal file
@ -0,0 +1,37 @@
|
||||
import pytest
|
||||
|
||||
import voicemeeterlib
|
||||
from tests import data, vm
|
||||
|
||||
|
||||
class TestErrors:
|
||||
__test__ = True
|
||||
|
||||
def test_it_tests_an_unknown_kind(self):
|
||||
with pytest.raises(
|
||||
voicemeeterlib.error.VMError,
|
||||
match=f"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",
|
||||
) as exc_info:
|
||||
vm.set("unknown.parameter", 1)
|
||||
|
||||
e = exc_info.value
|
||||
assert e.code == -3
|
||||
assert e.fn_name == "VBVMR_SetParameterFloat"
|
||||
|
||||
def test_it_tests_an_invalid_config(self):
|
||||
EXPECTED_MSG = (
|
||||
f"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:
|
||||
vm.apply_config("unknown")
|
||||
|
||||
e = exc_info.value
|
||||
assert e.message == "\n".join(EXPECTED_MSG)
|
@ -10,7 +10,7 @@ class TestRemoteFactories:
|
||||
data.name != "basic",
|
||||
reason="Skip test if kind is not basic",
|
||||
)
|
||||
def test_it_vm_remote_attrs_for_basic(self):
|
||||
def test_it_tests_vm_remote_attrs_for_basic(self):
|
||||
assert hasattr(vm, "strip")
|
||||
assert hasattr(vm, "bus")
|
||||
assert hasattr(vm, "command")
|
||||
@ -28,7 +28,7 @@ class TestRemoteFactories:
|
||||
data.name != "banana",
|
||||
reason="Skip test if kind is not banana",
|
||||
)
|
||||
def test_it_vm_remote_attrs_for_banana(self):
|
||||
def test_it_tests_vm_remote_attrs_for_banana(self):
|
||||
assert hasattr(vm, "strip")
|
||||
assert hasattr(vm, "bus")
|
||||
assert hasattr(vm, "command")
|
||||
@ -48,7 +48,7 @@ class TestRemoteFactories:
|
||||
data.name != "potato",
|
||||
reason="Skip test if kind is not potato",
|
||||
)
|
||||
def test_it_vm_remote_attrs_for_potato(self):
|
||||
def test_it_tests_vm_remote_attrs_for_potato(self):
|
||||
assert hasattr(vm, "strip")
|
||||
assert hasattr(vm, "bus")
|
||||
assert hasattr(vm, "command")
|
||||
|
Loading…
x
Reference in New Issue
Block a user