Exercise: Testing
Questions for: Testing
In Python testing, what does the
unittest.expectedFailure decorator indicate?
A:
Expects a failure and marks the test as passed if it fails
B:
Expects a failure and marks the test as failed if it passes
C:
Skips the test unless a condition is True
D:
Decorates the test method with a patch for mocking
Answer: A
The
unittest.expectedFailure decorator indicates that a test is expected to fail, and if it does fail, it is marked as passed.
What is the purpose of the
unittest.mock.patch.dict decorator?
A:
Decorates a test method with a patch for a dictionary
B:
Skips a test method based on a condition
C:
Creates a magical mock object for all methods of a dictionary
D:
Marks a test as skipped
Answer: A
The
unittest.mock.patch.dict decorator is used to decorate a test method with a patch for a dictionary in Python.Discuss About this Question.
What does the Python
unittest.skipUnless method do?
A:
Skips the entire test case
B:
Skips the next test method
C:
Skips the next test case
D:
Skips the test unless a condition is True
Answer: D
The
unittest.skipUnless method is used to skip a test unless a specified condition is True in Python unittest.Discuss About this Question.
What does the Python
unittest.mock.call_args_list attribute represent?
A:
The call arguments of a function or method
B:
The return value of a function or method
C:
The number of calls to a function or method
D:
The side effect of a function or method
Answer: A
The
unittest.mock.call_args_list attribute represents the call arguments of a function or method in Python unittest.mock.Discuss About this Question.
In Python's `unittest` module, what does the
assertIsNone method check?
A:
If a value is within a specified range
B:
If a condition is True
C:
If a value is
None
D:
If two values are equal
Answer: C
The
assertIsNone method in the unittest module checks if a value is None during testing.Discuss About this Question.
Ad Slot (Above Pagination)
Discuss About this Question.