Working with PyCharm’s debugger
In Chapter 1, I lauded PyCharm’s debugger as the single biggest reason to use an IDE versus a command-line debugger such as the standard Python debugger, which is called pdb. Don’t get me wrong – you should learn to use pdb because there will be times when the IDE isn’t available. However, I suspect that once you use PyCharm’s, you’ll prefer it over anything else. Let’s see if I’m right.
We have a problem in our Transaction
class that isn’t quite accurate. When it comes to testing, there are always two possibilities:
- The code is failing because of a flaw in the code under test.
- The code is failing because of the test code.
Since we don’t know which possibility is correct at this point, the debugger is going to allow us to step through our code one line at a time and inspect its inner workings. To do this, we need to set a breakpoint. A breakpoint marks...