The correct syntax uses a string with parameter names separated by commas and a list of tuples for values.
Step 2: Validate each option
@pytest.mark.parametrize('a,b', [(1, 2), (3, 4)]) matches the correct syntax. @pytest.mark.parametrize(['a', 'b'], [1, 2, 3, 4]) incorrectly uses a list of strings and a flat list of values. @pytest.mark.parametrize('a,b', [1, 2, 3, 4]) uses a flat list instead of tuples. @pytest.mark.parametrize('a', [1, 2]) @pytest.mark.parametrize('b', [3, 4]) applies two separate parametrize decorators, which is valid but changes test combinations.
Final Answer:
@pytest.mark.parametrize('a,b', [(1, 2), (3, 4)]) -> Option B
Quick Check:
Parametrize syntax = string names + list of tuples [OK]
Quick Trick:Use string names and list of tuples for multiple params [OK]
Common Mistakes:
MISTAKES
Passing flat lists instead of list of tuples
Using list of strings for parameter names
Applying multiple parametrize decorators without understanding combinations
Master "Parametrize" in PyTest
9 interactive learning modes - each teaches the same concept differently