Suppose this is my code:
def fun():
try:
raise Exception("An exception")
except Exception as e:
logger.debug(f'{e}')
Now how can I write a test case which checks if that particular exception was caught?
I could have tested by reading sys.stderr, but I'm using logger.debug.
I'm using django TestCase