Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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: #125

Open
aewallwi opened this issue May 3, 2021 · 0 comments

Comments

@aewallwi
Copy link
Collaborator

aewallwi commented May 3, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant