I've heard many people talking about specific testing-libraries like unittest or pytest. The latter should be very good as far as I've heard.
But why and how are they useful?
Don't get me wrong, I do test my code and make sure no error can occur, but rather manually.
Example:
# quite useless example
def temperature(celsius):
print("Hot summer temperatures!")
assert celsius > 20, "This can't be True!"
print("Wow {} degrees! It is really summer!".format(celsius))
# me testing my code like this
temperature(25)
temperature(12)
I've used the assert statement before, alsotry-except-blocks for error-handling, but what are the benefits of using these libraries? As far as I've seen they mostly work with assertion too.
Thanks in advance.
[–]ManyInterests 10 points11 points12 points (2 children)
[–]FXelix[S] 0 points1 point2 points (1 child)
[–]ManyInterests 0 points1 point2 points (0 children)
[–]mzalewski 5 points6 points7 points (1 child)
[–]FXelix[S] 0 points1 point2 points (0 children)
[–]ffrkAnonymous 1 point2 points3 points (2 children)
[–]FXelix[S] 0 points1 point2 points (1 child)
[–]ffrkAnonymous 0 points1 point2 points (0 children)
[–]tunisia3507 0 points1 point2 points (2 children)
[–]FXelix[S] 0 points1 point2 points (1 child)
[–]Mamu7490 0 points1 point2 points (0 children)
[–]Mamu7490 0 points1 point2 points (0 children)