#Python #Shorts
One cool thing about Python is how easy it is to write tests. The craziest part is, we can use documentation as tests! All we need to do is put "{three greater than signs here}" (Youtube won't allow bracket signs in the description) and the function call on one line, the expected value on the next line, and voila, we have a test! There are a few ways to run those, refer to https://docs.python.org/3/library/doc... to find what suits you best.
One of the simpler ways is to just import "doctest" and call "doctest.testmod()".
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter: / evgenyurubkov
Instagram: / evgenyurubkov
Youtube: / @codevev
Watch video Python - Documentation as Tests! online without registration, duration hours minute second in high quality. This video was added by user codevev 22 May 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 357 once and liked it 14 people.