Understand Python unit tests in 5 minutes

9 months ago
5

In this video I show you an overview of unit tests in Python: what they are, how they work and how to write effective ones by looking at real world examples.

Links:

- Python 3 documentation for unit tests: https://docs.python.org/3/library/unittest.html
- md-toc: https://github.com/frnmst/md-toc/

CHAPTERS

0:00 Intro
0:08 Brief explanation
0:51 Steps to setup unit tests
1:12 Directory structure
1:22 tests.py file structure: unittest module, inherited classes, test_ methods
2:27 The strcmp_a function example
2:46 strcmp_a unit tests explained in detail
3:25 Running the tests
3:30 Setting a wrong value in a unit test on purpose to see what happens
3:40 The _replace_string function in md-toc
4:09 _replace_string unit tests
4:33 Running all tests in md-toc
4:53 Lines of code of unit tests compared to the rest of the code in md-toc
5:07 Outtro

#unittests #python #mdtoc

Loading comments...