<AptiCode/>

Question 457: How can you check if a Python function raises a specific exception during testing?

tcs
wipro
infosys
general
aptitude
testing

TheassertRaisesmethod in theunittestmodule is used to check if a specific exception is raised by a Python function during testing.