Rather than do a loop that tests many choices of window function, this should be parametrized. It should also be broken up into multiple test functions--one that tests basic parameters (e.g. window length, type, and range), and one that tests normalization. There's certainly a way to parametrize fixtures so that you don't need to repeat code when parametrizing over windows, though I don't remember how to do it off the top of my head. Here's a quick example of one such rewrite:
@pytest.mark.parametrize("window_type", ["none", "blackmanharris", "hann"])
def test_window_range(window_type):
window = dspec.gen_window(window_type, 100)
assert np.all((window >= 0) & (window <= 1))
Of course in the actual test you'll want to include more choices of window function. If you want to get the full outer product of different parameter choices, then you'll do successive @pytest.mark.parametrize decorations, e.g.
@pytest.mark.parametrize("param1", [val1, val2, val3])
@pytest.mark.parametrize("param2", [val4, val5])
def test_example(param1, param2):
...
The above example will test all 6 possible pairings of values from the two parameter lists.
Originally posted by @r-pascua in #112 (comment)