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

Is it possible to stack decorators to create a matrix similar to pytest.mark.parameterize? #121

Open
markddavidoff opened this issue Mar 26, 2021 · 3 comments

Comments

@markddavidoff
Copy link

Ex:

@parameterized.expand([(True,), (False,)])
@parameterized.expand([(0,), (1,)])
def test_test(_bool, _num):
    """
    would get:
    True 0
    False 0
    True 1
    False 1
    """
@markddavidoff
Copy link
Author

markddavidoff commented Mar 26, 2021

Similar to #102

@RevolutionTech
Copy link

This feature would be nice, but in the meantime I am using itertools.product(), so your example above would look something like:

import itertools
...

@parameterized.expand(itertools.product([True, False], [0, 1], repeat=1))
def test_test(_bool, _num):
    ...

@stucox
Copy link

stucox commented Jan 9, 2022

Alternative syntax you can use for this without itertools.product() is:

@parameterized.expand(
    (_bool, _num)
    for _bool in (True, False)
    for _num in (0, 1)
)
def test_test(_bool, _num):
    ...

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

3 participants