Doctests: Should you use them in every function
· 2 min read
So I’ve been thinking lately about testing strategies again, and one question came up that I kept circling back to: does every function in my Python codebase need to have a doctest?
So I’ve been thinking lately about testing strategies again, and one question came up that I kept circling back to: does every function in my Python codebase need to have a doctest?
Writing docstrings in Python can feel like a chore — especially with the odd formatting involving triple quotes, >>>
signs, and parameter blocks. But clear, standardized docstrings are critical for both readability and maintainability.
If you’re using VSCode (Visual Studio Code), you’re in luck. With a few extensions and configurations, you can make writing professional, PEP 257-compliant docstrings painless.
Testing Python Apps with Pytest and Doctest: A Symbiotic Approach
How to test an app using both pytest and doctest in a complementary (symbiotic) way: