pumping python: how I solve problems with test driven development¶
My name is Jacob Itegboje and this is a collection of Test Driven Development exercises that have helped me use Python for more than a decade. Test Driven Development is a way to write software with a focus on tests. I write tests for ideas to reach a goal or meet a requirement, and the results tell me if I am closer to the goal or not. I repeat the process until I get to the goal.
I recommend reading Kent Beck’s Test Driven Development by Example and Martin Fowler’s Refactoring, they both influenced the way I write programs.
who is this for?¶
If you are interested in Python, this is for you
If you just started your journey, CONGRATULATIONS! You picked Python from the many programming languages out there, Celebrate it, this is for you
If you are new to Test Driven Development in Python, this is for you
If you already use Python but do not know any of the Exceptions below, this is for you
how can I use this?¶
Start with how to make a python test driven development environment because it is needed by the other chapters, then choose how you go through the chapters based on what you like, or you could go through the howtos section step by step, the other chapters cover errors, data structures, functions, and classes
Here are a few things I would do if I were in your shoes to make the process more fun
type out the code portions of a chapter without copying and pasting
at the end of a chapter, delete the tests and try to write them from memory or use the solution as a guide
close the tests at the end of a chapter, delete the solution and try to write one with the terminal response as a guide
try to write solutions using the tests from the catalog of tests as a guide
try adding tests for any ideas I get as I go through a chapter, the sooner you start writing tests the better since it requires a different way of thinking
I would not quit until I get to the end of a chapter, especially when it is hard, this is part of the experience when learning to solve problems, things get harder before they are easier because there is a lot of failure. I can always walk away to go do something different for a while, then come back and try again. If you take one small step at a time you eventually get where you want to go
There are videos for every chapter, check them out here https://www.youtube.com/@JacobItegboje
howtos¶
table of contents¶
- conventions
- errors
- data structures
- booleans: truth table
- functions
- classes
- catalog of tests
- tests and solutions
- makePythonTdd.sh
- makePythonTdd.ps1
- how to make a calculator
- how to pass values
- how to make a person
- how to test/handle exceptions
- how to measure sleep duration
- ModuleNotFoundError
- AssertionError
- AttributeError
- TypeError
- None
- booleans
- truth table
- lists
- list comprehensions
- dictionaries
- functions
- classes
- can we measure learning?
- dot notation
- pumping python review
music¶
Here is a playlist I like to listen to when programming