Code related to Sandro Mancuso's Testing legacy code: Hard-wired dependencies blog post. Try not reading the blog post before doing the exercise yourself.
Provides an example of existing code that needs to be unit tested. But there is one rule:
We can't change any existing code if not covered by tests. The only exception is if we need to change the code to add unit tests, but in this case, just automated refactorings (via IDE) are allowed.
Although this is a very small piece of code, it has a lot of the problems that we find in legacy code.
Since the original is from Java, there is both a mechanical translation and an idiomatic python translation. The idiomatic, single-file translation is tripservice.py, while the mechanical translation can be found in the tripservice_mechanical directory.
It is recommended that you use the idiomatic translation when giving trying this kata in python. You should attempt to refactor by unit testing it following the rule above.
For future comparisions, when you are done, you can always check tripservice_original.py