-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
The current syntax for providing an id along with a parameter set is:
@pytest.mark.parameterize('a,b', [
pytest.param(1, 3, id='odds'),
pytest.param(2, 4, id='evens'),
])
def test_something(a, b):
...
I'd like to get peoples' opinions about an alternative syntax:
@pytest.mark.parameterize('a,b', {
'odds': (1, 3),
'evens': (2, 4),
})
def test_something(a, b):
...
The rationale, other than the alternative being shorter, is that (it seems to me) that mappings are natural for pairing identifiers and data. If we have to decide on a way to interpret someone passing a mapping into argvalues
, I think that'll be a natural one.
P.S. currently, if you pass a dictionary as argvalues
, its keys are iterated and the values are discarded
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature