+ 1
What is the importance of "assertions" statement in python??
2 Answers
+ 6
Black Box Tests. Debugging, finding out if your code delivers the correct results by using examples.
+ 1
You need to understand the difference between assertion with try/except. Exceptions address the robustness of your application while assertions address its correctness.
Assertions should be used to check something that should never happen while an exception should be used to check something that might happen (something in which you don't have control like user input).
NOTE: The thumb rule is that use assertions when you are trying to catch your own errors and exceptions when trying to catch other people's errors.