6 ms·
That's the best idea I've seen in a long time. Give an expr, get a value, and if you like it, type something meaning "add a test that evals that expr and expect
by prodigal_erik 17y ago
That's the best idea I've seen in a long time. Give an expr, get a value, and if you like it, type something meaning "add a test that evals that expr and expects the value I just saw". The only risk is convincing yourself that what you got looks right when it's actually not.
- blasdel 17y agodoctest comes with Python. You paste from REPL sessions into doccomments, and use a little utility function to automatically find/run them. It's not as useful as you'd think -- the only way to structure the tests is by the class or function the comment is on, and you have to go out of your way to avoid default __repr__ returns of the form "<object foo at 0xADDRESS>", as the expected response handling is ANAL.