Test Python properly with pytest, unittest, doctest, and type hints, and the tooling jobs expect.
Five courses of Python, five things built, and not one line anywhere that says what any of it is supposed to do. You checked your work the way everybody checks their work: you ran it and read the output. That works exactly once. It says nothing about the version you will have after tomorrow's change, and it is the reason a junior pull request comes back with one comment on it. This course is the habit that fixes that, in the order the habit actually forms. First a check you write by hand, so `assert` is never magic. Then `unittest`, which is in the standard library and therefore in every codebase that did not choose otherwise. Then pytest, which is what most teams write today, and it arrives after `unittest` on purpose: its advantages only look like advantages once you have written the verbose version yourself. Then the things that separate a suite somebody maintains from a suite somebody deletes: fixtures, parametrized tables, testing the failures, and knowing what not to test. Everything is built on Fareboard, a transit fare calculator with genuinely awkward rules: three zones, a peak surcharge, a concession divisor, and a daily cap that interacts with all of them. It is the right thing to test because its rules collide, so the edge cases are real rather than invented. By the end you can take a module somebody handed you, cover it with a suite that would catch a real regression, annotate it so the next reader knows what goes in and out, and read the `pyproject.toml` that says how the project is put together.
45 Lessons • 53 Practices • 18 Quizzes • 4 Projects · ~10h Total
Not just theory. You finish this course with real work to show.
This is the same in-browser editor every lesson uses. Edit the code, hit Run.
Run code in the browser and see the result immediately. Every lesson works this way.
Stuck? Puff explains the error and nudges you forward, without giving the answer away.
Streaks, diamonds, and certificates. Your progress saves automatically, forever.
Every completed course issues a certificate with a public verification link.
Every certificate has a public verification link employers can check.
One certificate per course. Finish a program and earn its program certificate too.
LinkedIn-ready, with a PDF you can download and attach.
You have built real things and checked every one by running it and looking. This is the habit that replaces looking.
A pull request without tests goes back. This is what the reviewer is asking for, and why.
Fixtures appear by name and decorators multiply your tests. Both are ordinary Python, and this course shows the machinery.
Python Testing is free to start, no credit card needed. Some later sections are part of Pro, and finishing every section, including the certificate, needs a Pro plan.
Yes, through Python File Handling. Decorators and exceptions do the most work here and are assumed rather than re-taught: `@pytest.mark.parametrize` is a decorator, and `pytest.raises` is a context manager over an exception. Git Basics sits before this course in the Python Developer program and is not needed for anything in it.
Both, and this course teaches unittest first. unittest is in the Python standard library, so it is in every codebase that did not deliberately choose something else, and a developer who has only seen pytest cannot read an existing suite. pytest is what most teams write today, and its advantages are much easier to see once you have written the same test the verbose way.
No. Python ignores them at runtime, and section 7 is honest about that in its first two sentences. They exist so that a reader and a type checker can both tell what a function expects and returns, which is how a mistake gets found before the program runs rather than after.
Because nothing shells out in a browser tab. Python itself is real, running as CPython on WebAssembly, but there is no command line for pip, virtual environments, black, or mypy. Section 8 teaches what each of those does and what it changes, and it reads a real pyproject.toml with tomllib rather than showing you a picture of one.
Fareboard's test suite: a fare calculator with three zones, a peak surcharge, a concession rate, and a daily cap, covered by hand-written checks, then a unittest suite, then a pytest suite with fixtures, a parametrized fare table, tests for the errors it should raise, type annotations, and doctests.
Yes, for this course at 100 percent. It also counts towards the Python Developer program certificate, which issues once every course in that program is complete.
How this course connects to the bigger picture, and what to explore next.
Run concurrent work in Python with asyncio: coroutines, tasks, queues, timeouts, and cancellation.
Git from zero: commit, branch, merge, undo, and tag real repositories in a live terminal.
Write real Python in your browser: variables, strings, conditionals, loops, lists, and functions.
Free to start, no credit card required. Write real code from the first lesson and keep your progress forever.
Start Learning Free