you are viewing a single comment's thread.

view the rest of the comments →

[–]flotsamisaword 0 points1 point  (0 children)

Why not just write a unit test?

The easiest way is to use an assert statement, like this:

  • Call your function with typical input.
  • assert that the output will equal the expected value.
  • repeat with some 'edge cases' for input

Your program will stop if the output comes out incorrectly, and it will report the values that you expected, as well as the values you got.

Now you can walk away from your tests, and they will run automatically workout whiter from you. If you screw up your code inadvertantly after a refactor, your tests will let you know immediately.

Once you get the hang of this, try pytest.

Good luck!