Bird
Raised Fist0

Find the bug in this test snippet:

medium📝 Debug Q7 of Q15
Testing Fundamentals - Why Software Testing Matters
Find the bug in this test snippet:
def test_uppercase():
    text = 'hello'
    assert text.upper == 'HELLO'
AVariable text is not defined
BMissing parentheses after upper method call
CWrong expected value, should be 'hello'
DTest syntax is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check method usage

    upper is a method and needs parentheses to call.
  2. Step 2: Identify error in assertion

    text.upper is a method object, not string; should be text.upper()
  3. Final Answer:

    Missing parentheses after upper method call -> Option B
  4. Quick Check:

    Method call needs () to execute [OK]
Quick Trick: Always use () to call methods, not just name [OK]
Common Mistakes:
MISTAKES
  • Forgetting parentheses on method calls
  • Confusing method with attribute

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes