I am trying to write a unit test for a code, in which there is a method which is called whenever an exception is raised. Now this method is called by multiple exceptions. My main aim is to write down a unit test for which I am able to assert whether the said exception is the trigger for that method.
For example: (generic method divide)
try:
divide(2,0)
except ZeroDivisionError:
method_to_be_called()
Now in my test case, i want to test whether the triggering exception for method_to_be_called() is ZeroDivisionError Any ideas on how I can accomplish that?