0
0
Testing Fundamentalstesting~10 mins

Data integrity checks in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if the data list is not empty before processing.

Testing Fundamentals
if [1]:
    print("Data is ready for processing")
Drag options to blanks, or click blank then click option'
Alen(data) == 0
Bdata == None
Cdata is False
Dlen(data) > 0
Attempts:
3 left
💡 Hint
Common Mistakes
Checking if data is None instead of checking its length.
Using equality to False which is not correct for lists.
2fill in blank
medium

Complete the code to assert that the 'user_id' field exists in the data dictionary.

Testing Fundamentals
assert [1] in data, "user_id missing"
Drag options to blanks, or click blank then click option'
Adata['user_id']
Buser_id
C'user_id'
Ddata.user_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using data['user_id'] directly which causes error if key missing.
Using variable user_id without quotes.
3fill in blank
hard

Fix the error in the assertion that checks if the 'age' value is an integer.

Testing Fundamentals
assert isinstance(data.get('age'), [1]), "Age must be integer"
Drag options to blanks, or click blank then click option'
Alist
Bint
Cstr
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using string or float types instead of int.
Not using isinstance and causing runtime errors.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that keeps only keys with non-empty string values.

Testing Fundamentals
{k: v for k, v in data.items() if v [1] '' and isinstance(v, [2])}
Drag options to blanks, or click blank then click option'
A!=
B==
Cstr
Dint
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '!=' causing wrong filtering.
Checking for int type instead of str.
5fill in blank
hard

Fill all three blanks to create a test that asserts all values in the list are unique.

Testing Fundamentals
assert len([1]) == len([2]), "Values are not unique"
unique_values = set([3])
Drag options to blanks, or click blank then click option'
Avalues
Bset(values)
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing set to list in wrong order.
Using different variable names causing errors.