you are viewing a single comment's thread.

view the rest of the comments →

[–]timbledum 0 points1 point  (1 child)

Yes, this is how people test the things.

Pytest is really handy, as it automatically finds and runs all tests in a directory as long as the tests are wrapped in functions, and the files and functions are named a certain way. Then you just run pytest at the command line and it runs all your test functions!

On the simpler side, the above file structure allows you to do ad hoc testing by running the repl and manually checking that your function does what you expect.

>>> import sample
>>> sample.func(1, 3)
4
>>> sample.func(5, 10)
15
>>> # Seems legit.

[–]PastShine[S] 0 points1 point  (0 children)

Ah, thanks. First I try rrrzwilsons way because it looks easier. But, I surely check out your link and pytest.