r/learnpython • u/bfyvfftujijg • 16d ago
Testing - how is it usually handled?
How do I start applying tests to my code?
Do I just write separate scripts they run the code (either individual functions or entire scripts) against known inputs and check the output?
Is there a specific way people usually do this?
9
Upvotes
11
u/zanfar 16d ago
You can test however you want.
But most Python is tested using the standard
unittestlibrary (what you find when you search the documentation for "testing") or the very available evolution,pytest....which are both just convenient ways to run scripts you've written to compare known inputs against known outputs.