Doctests in Python

1 · Hillel Wayne · Feb. 16, 2017, midnight
Doctests are one of the most fascinating things in Python. Not necessarily because it’s particularly elegant or useful, but because it’s unique: I haven’t found another language that has a similar kind of feature. Here’s how it works. Imagine I was writing an adder: def add(a,b): return a + b There’s two kinds of ways we can test it. The first is with unit tests, which everybody’s already used to....