Bird
0
0

What will happen if you run this test?

medium📝 Predict Output Q5 of 15
Selenium Python - Data-Driven Testing
What will happen if you run this test?
import pytest

@pytest.mark.parametrize('text', ['hello', 'world'])
def test_upper(text):
    assert text.upper() == text
AFirst test passes, second fails
BBoth tests pass because upper() returns original
CBoth tests fail because uppercase does not equal original
DSyntax error due to wrong parameter format
Step-by-Step Solution
Solution:
  1. Step 1: Understand test assertion

    The test asserts text.upper() == text, meaning uppercase must equal original.
  2. Step 2: Check input values

    'hello'.upper() is 'HELLO', not 'hello'. 'world'.upper() is 'WORLD', not 'world'. Both fail.
  3. Final Answer:

    Both tests fail because uppercase does not equal original -> Option C
  4. Quick Check:

    Uppercase != original for lowercase strings = Fail [OK]
Quick Trick: Uppercase string differs from lowercase original [OK]
Common Mistakes:
  • Assuming upper() returns original string
  • Ignoring case sensitivity in assertion
  • Thinking parameter format is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes