Chapter 3 Testing with DocTest

This is an additional material which is not covered in Python for Everybody. For this topic, there is corresponding reading matterial (see links below).

3.1 Lecture on Testing

The lecture consists of two parts:

  • the first one presenting concepts,
  • the second one presenting possible implementation.

3.1.1 Introduction to Testing

Videos, listed below, are introduce general concepts independent of a programming language.

The corresponding chapter is avaliable here.

Remarks for students from 198803:

  • the aspects video is highly recommended,
  • the testing suite video is for students who want to understand how to write test cases, it contains Python code, but so basic, that there is a straightforward mapping to R,
  • the error handling video from a Python perspective, but it contains some general ideas, too.

Remarks for students from 198801: Just if you wonder, you are supposed to watch all the videos.

20S198801 U06 L00 testing agenda
duration: 02:05
20S198801 U06 L01 testing intuition
duration: 10:59
20W198801 U06 L02 testing aspects
duration: 15:58
20S198801 U06 L03 testing suite
duration: 15:38
20S198801 U06 L05 testing error handling
duration: 06:55
total duration: 51:35

3.1.2 Testing in Python

Next video explain testing in Python using Doctest. There are also other options for testing in Python.

The corresponding chapter is avaliable here.

20S198801 U06 L04 testing doctest
duration: 08:38


3.2 Exercises on Testing

20S198801 U06 D01 testing barcode
duration: 08:47
20S198801 U06 D02 testing programs
duration: 01:52
20S198801 U06 D03 testing suite
duration: 03:52
20S198801 U06 D03 testing error handling
duration: 10:06
total duration: 24:37


  • the material is provided in OLAT