Bird
0
0

Identify the error in this parameterized test code:

medium📝 Debug Q14 of 15
Selenium Python - Test Framework Integration (pytest)
Identify the error in this parameterized test code:
import pytest

@pytest.mark.parametrize('input, expected')
def test_double(input, expected):
    assert input * 2 == expected

@pytest.mark.parametrize('input, expected', [(2, 4), (3, 6)])
AWrong assertion operator used.
BMissing data list for parameterize decorator on test_double.
CParameters names should be a list, not a string.
DTest function name is invalid.
Step-by-Step Solution
Solution:
  1. Step 1: Check the decorator usage on test_double

    The decorator @pytest.mark.parametrize('input, expected') is missing the second argument: the list of data tuples.
  2. Step 2: Verify other parts

    Assertion and function name are correct. Parameter names as string is valid syntax.
  3. Final Answer:

    Missing data list for parameterize decorator on test_double. -> Option B
  4. Quick Check:

    Decorator needs data list argument [OK]
Quick Trick: Always provide data list with parametrize decorator [OK]
Common Mistakes:
  • Forgetting the data list argument
  • Using list instead of string for parameter names (which is allowed but less common)
  • Misreading assertion syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes