Python - Documentation as Tests!

Опубликовано: 22 Май 2021
на канале: codevev
357
14

#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  


Смотрите видео Python - Documentation as Tests! онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь codevev 22 Май 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 357 раз и оно понравилось 14 людям.