+ 1

What is the importance of "assertions" statement in python??

13th Feb 2018, 12:53 PM
Mahmoud Essam
Mahmoud Essam - avatar
2 Respostas
+ 6
Black Box Tests. Debugging, finding out if your code delivers the correct results by using examples.
13th Feb 2018, 12:56 PM
Chris
Chris - avatar
+ 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.
16th Nov 2018, 3:32 AM
Tamoghna Saha