Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to call the integration test function.
Testing Fundamentals
def test_integration(): result = [1]() assert result == 'success'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling a unit test function instead of integration test.
✗ Incorrect
The function integration_test() is the correct call for integration testing.
2fill in blank
mediumComplete the code to check if the integration test passed.
Testing Fundamentals
def check_result(output): if output [1] 'success': return True return False
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' causes wrong test results.
✗ Incorrect
We use == to check if the output equals 'success'.
3fill in blank
hardFix the error in the integration test assertion.
Testing Fundamentals
def test_integration(): output = integration_test() assert output [1] 'success'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' in assert causes syntax error.
✗ Incorrect
The assertion requires the equality operator ==, not assignment =.
4fill in blank
hardFill both blanks to create a dictionary of test results where keys are test names and values are their statuses.
Testing Fundamentals
test_results = {"login": [1], "payment": [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up test names and statuses.
✗ Incorrect
The login test passed, so its value is 'passed'. The payment test failed, so its value is 'failed'.
5fill in blank
hardFill both blanks to create a filtered dictionary of tests that passed.
Testing Fundamentals
passed_tests = {k: v for k, v in test_results.items() if v {BLANK_2}} {{BLANK_2}} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong operators or missing quotes around 'passed'.
✗ Incorrect
The dictionary comprehension uses ':' to map keys to values, and filters where value equals 'passed'.