Bird
0
0

Identify the error in this parametrize usage:

medium📝 Debug Q6 of 15
PyTest - Parametrize
Identify the error in this parametrize usage:
@pytest.mark.parametrize('x', [1, 2], ids='one', 'two')
def test_x(x):
    assert x > 0
Aids should be a single list, not separate strings
Bids cannot be used with integers
Cids must be a dictionary, not list
Dids parameter is not supported in parametrize
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of ids parameter

    The ids argument must be a single iterable (like a list) of strings.
  2. Step 2: Identify error in given code

    Here, ids='one', 'two' passes two separate strings, which is invalid syntax.
  3. Final Answer:

    ids should be a single list, not separate strings -> Option A
  4. Quick Check:

    ids must be a list or iterable [OK]
Quick Trick: Pass IDs as one list, not multiple strings [OK]
Common Mistakes:
MISTAKES
  • Passing multiple strings instead of list
  • Using wrong data types for ids
  • Assuming ids is unsupported

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes