Posts

Showing posts from July, 2017

Unittests

In this post we will start understanding an interesting topic in python i.e Unit_tests and most important of all while developing any software is understanding the actual use-case and be clear with the tests to be covered to verify the working of the use-case. Unit tests are that type of tests which are not considered as functional tests rather, It is used to do some basic testing of python definitions by sending some fake parameters to the actual definitions in source code and assert the expected values Say suppose now u have written a code to test whether a number is a prime or not we send some random value and check whether we get the expected value or not. So, our use-case is to check whether the number gave by user is prime or not? So, the tests to be checked are  - Composite numbers shouldn't be returned as prime.  - Negative numbers mustnot be considered as a prime number.  - check when a prime number is given by user it returns True. mkdir test_1 &&