There are several testing libraries in Python. One of the simplest is called doctest. It is good for stand-alone libraries, not something where you need a lot of work to set up the environment, but then it is a great way to also ensure that the documentation is correct.