Introduction
We check exception attributes to make sure errors happen as expected and carry the right information.
When you want to confirm a function raises an error with a specific message.
When testing that an error has a certain code or property.
When verifying that your program handles wrong inputs correctly by raising exceptions.
When you want to catch and inspect details of an error during automated tests.