Python Tip #243 (of 365): Write automated tests. You can test manually (run your...

@treyhunner@mastodon.social

Python Tip #243 (of 365):

Write automated tests.

You can test manually (run your code to make sure it works), or write automated tests: code that tests your code, like this:

def test_no_tax():
assert calculate_total([3.50, 13.75], apply_tax=False) == 17.25

Every time you change your code, your automated tests can tell you whether you broke something... without you needing to manually check every possible scenario.

๐Ÿงต (1/3)

#Python #DailyPythonTip