У нас вы можете посмотреть бесплатно Intro to Python Mocks | Python tutorial или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса savevideohd.ru
This video is an Intro to Python Mocks from unittest.mock library: what are Python mocks, why we have to use mocks, and when to do it. How to write Python tests for functions that make a request to external API. How to use the patch function to test Requests based functions with Python unittest.mock library. It's a Python unittest mock tutorial for beginners. Follow me @: Telegram: https://t.me/red_eyed_coder_club Twitter: / codereyed Facebook: https://fb.me/redeyedcoderclub Timecodes: 00:00 - ideal testable function, and a unit test for it. 02:29 - example of a function with a dependency on another function. 06:02 - a test for the function with a dependency on another function. Problems that Mocks will solve. 07:48 - patch() function from unittest.mock 11:28 - an example of unit test of a function that makes a request to external API and returns a different result each time it's been called. A mock returns another mock. How to test requests. Why Python mocks are important: Mocks eliminate dependency on network, database calls, calls to OS (it will speed testing) we get isolated unit tests, we can test methods that have no return value reduce test complexity. We don't have to write complex logic to handle behavior of methods under tests. don't have to wait to implement other methods. When should you mock? When you don't want to actually call an object Intro to Python Mocks | Python tutorial • Intro to Python Mocks | Python tutorial #python #testing #redeyedcoderclub