Fixtures like these make the function less readable, have no actual benefit over normal functions (as in, they don't need session scope etc.)
|
@pytest.fixture |
|
def load_channel(get_model: ModelFixture): |
|
def wrapper(preset: str, type: type[Channel] = Channel): |
|
return get_model(f"channels/{preset}", type) |
|
|
|
return wrapper |
|
|
|
|
|
@pytest.fixture |
|
def load_instrument(load_channel: ModelFixture): |
|
def wrapper(preset: str): |
|
return load_channel(preset, Instrument) |
|
|
|
return wrapper |
|
|
|
|
|
@pytest.fixture |
|
def load_layer(load_channel: Any): |
|
def wrapper(preset: str): |
|
return load_channel(preset, Layer) |
|
|
|
return wrapper |
|
|
|
|
|
@pytest.fixture |
|
def load_sampler(load_channel: Any): |
|
def wrapper(preset: str): |
|
return load_channel(preset, Sampler) |
|
|
|
return wrapper |
Additional type-hinting code is required as well to pass them as arguments to a test function:
|
ChannelFixture = Callable[[str], Channel] |
|
InstrumentFixture = Callable[[str], Instrument] |
|
LayerFixture = Callable[[str], Layer] |
|
SamplerFixture = Callable[[str], Sampler] |
Fixtures like these make the function less readable, have no actual benefit over normal functions (as in, they don't need session scope etc.)
PyFLP/tests/test_channel.py
Lines 28 to 57 in b3999df
Additional type-hinting code is required as well to pass them as arguments to a test function:
PyFLP/tests/test_channel.py
Lines 22 to 25 in b3999df