Closed keunwoochoi closed 5 years ago
If the test success depends on a combination of different parameters, you can also combine them yourself, e.g. change
@pytest.mark.parametrize('fft_len', [512])
@pytest.mark.parametrize('hop_len', [256])
@pytest.mark.parametrize('waveform', [
(torch.randn(1, 100000)),
(torch.randn(1, 2, 100000)),
pytest.param(torch.randn(1, 100), marks=xfail(raises=RuntimeError)),
])
@pytest.mark.parametrize('pad_mode', [
# 'constant',
'reflect',
])
to
@pytest.mark.parametrize('waveform,pad_mode,fft_len,'hop_len'', [
(torch.randn(1, 100000), 'constant', 512, 256),
(torch.randn(1, 2, 100000), 'constant', 512, 256),
(torch.randn(1, 100), 'constant', 512, 256),
(torch.randn(1, 100000), 'reflect', 512, 256),
(torch.randn(1, 2, 100000), 'reflect', 512, 256),
pytest.param(torch.randn(1, 100), 'reflect', 512, 256, marks=xfail(raises=RuntimeError)),
])
Now you have to specify every case yourself.
@hagenw Thanks. I think we can do it by creating two classes that simply inherits from the test, I'll push it later.
On testing - because we're gonna rely on torch.stft
for the padding, i won't worry about pad test too much here.
(oh damn, it's mixed with #56....)
'reflect'
padding with shorter-than-fft_len
signal is expected to fail, while'constant'
padding with shorter-than-fft_len
signal is expected to succeed. i haven't figured out how to configure this in pytest.@hagenw do you know how to do this with
pytest
?