Python Programming - Testing - Discussion

Discussion Forum : Testing - General Questions (Q.No. 1)
1.
How can you check if a Python function raises a specific exception during testing?
Use the assertRaises method from the unittest module
Utilize the expectException decorator
Employ the checkException function in the testing module
Insert a try-except block and manually check for the exception
Answer: Option
Explanation:
The assertRaises method in the unittest module is used to check if a specific exception is raised by a Python function during testing.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.