Brainlag
  1. Python
  2. Advanced
33/42 lessons

Testing your own code

30 min6 exercisesPremium

Write simple tests in Python with assert: test functions, edge cases and boundaries, tests that catch real bugs, and writing the test before the code.

The skill
Write tests that catch real bugs, boundaries included.
You make
Leap year tests, a URL slug maker and a password checker with its own tests.

Premium lesson

£7.99 a month or £59 a year. Cancel any time.

Builds on 32 Type hints. Free to try: Python Foundations and the playground.

Step 1 of 9
exercise_1.py

You've reached the good stuff.

6 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.

Python 3.13