22
Python UNIT Testing
It is the processing of testing whether a particular unit is working properly or not is called unit testing
Here we need to be careful that setUp and tearDown method names are fixed but we can change the test method name as we like bit it need to be prefix with "test" example test_sample(), test1().
We can include as many test methods we want into the class
Note
For every test method setUp(),tearDown() methods will be executed.
To avoid this repeated call of setUp and tearDown methods we can use setUpClass(), tearDownClass() methods, now only one time setup and teardown methods are called regardless of how many number of testcases.

O/P

You can also use assert functions in test method
Hope you learned something!!!
Happy coding!!!
Happy coding!!!
22