Bird
0
0

What will pytest report when running this test?

medium📝 Predict Output Q5 of 15
PyTest - Test Organization
What will pytest report when running this test?
def test_fail():
    assert 3 * 3 == 10
ATest fails with AssertionError
BTest is ignored
CTest passes successfully
DSyntax error stops test run
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the assertion condition

    The assertion checks if 3 * 3 equals 10, which is false (3 * 3 = 9).
  2. Step 2: Understand pytest behavior on false assertions

    Pytest reports a failure with an AssertionError when the assertion is false.
  3. Final Answer:

    Test fails with AssertionError -> Option A
  4. Quick Check:

    False assertion = Test fails [OK]
Quick Trick: False assertions cause test failures [OK]
Common Mistakes:
MISTAKES
  • Thinking test passes despite false assertion
  • Confusing test failure with syntax error
  • Assuming tests skip without skip markers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes