Testing and Debugging
Writing and Running Unit Tests with Unittest or Pytest
Unittest and Pytest are two of the most used unit testing frameworks in Python1.
Pytest will automatically collect unittest.TestCase subclasses and their test methods in test_*.py or *_test.py files2.
Almost all unittest features are supported: @unittest.skip style decorators; setUp/tearDown; setUpClass/tearDownClass; setUpModule/tearDownModule2.
Youtube video link talked about this topic:
Example
# Example 1: Basic structure of unittest
import unittest
class Testing(unittest.TestCase):
def test_string(self):
a = 'some'
b = 'some'
self.assertEqual(a, b)
def test_boolean(self):
a = True
b = True
self.assertEqual(a, b)
if __name__ == '__main__':
unittest.main()Debugging Techniques and Tools
Youtube video link talked about this topic:
Example of coding:
Code Profiling and Optimization
Youtube video link talked about this topic:
Example
Last updated