Professional Python Testing with Mocks

  Рет қаралды 41,467

NeuralNine

NeuralNine

11 ай бұрын

In this video, we learn how to professionally test Python code with mocks.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine.com/books/
💻 The Algorithm Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
💼 Services 💼
💻 Freelancing & Tutoring: www.neuralnine.com/services
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎙 Discord: / discord

Пікірлер: 25
@20ted09
@20ted09 8 ай бұрын
This is now my GO TO channel for python. Absolutely top class tutorials!
@justmogen7383
@justmogen7383 7 ай бұрын
the explanation from beginning is awesome mahn! Very concise
@joaovitorfrossard7317
@joaovitorfrossard7317 4 ай бұрын
English is my second language and the explainings are so clear that I understood everything in this tutorial. Very well explained and examplified. Thank you so much.
@sadikplayz976
@sadikplayz976 11 ай бұрын
This channel is underrated AF!
@highradqa
@highradqa 27 күн бұрын
You're my champion from now on dude. Great vid !!!!!!!
@JorgeEscobarMX
@JorgeEscobarMX 11 ай бұрын
Most people don't use mocks and they just hope that the database or the internet or whatever other service works during the test run phase. A good use case is when there is expected to get a reponse from the user like in the input() function, the test would just wait until someone input some data and press enter. Mocking the input() function allows the test to run uninterrupted.
@ButchCassidyAndSundanceKid
@ButchCassidyAndSundanceKid 11 ай бұрын
Very well explained. Thanks.
@mohitmansi11
@mohitmansi11 4 ай бұрын
Very well explained. Please come up with more such videos and examples. Thanks .
@geordiehowell9087
@geordiehowell9087 8 ай бұрын
such great explanation. thank you
@JorgeEscobarMX
@JorgeEscobarMX 11 ай бұрын
A little chaotic and the examples were very well done.
@allandasantos9680
@allandasantos9680 6 ай бұрын
Very good. I would like to see more videos about mocks but using magic mock
@thee_apedo_guy
@thee_apedo_guy 3 ай бұрын
That was sensational, feeling 🏋️‍♀️🏋️‍♀️
@eugenmalatov5470
@eugenmalatov5470 2 ай бұрын
The introduction was excellent. But then I do not understand the first example. The individual lines are not really very well explained. How does the assert_called_with work, and why does it send an error?
@dsinghr
@dsinghr 2 ай бұрын
this was very helpful. Is there a follow up video for more such examples? thanks
@CristianMolina
@CristianMolina 4 ай бұрын
Also, to test error conditions it's great to use mocks on the dependencies
@Deepu1014
@Deepu1014 5 ай бұрын
What is MagicMock? Can you show small demo with it?
@alavvaf
@alavvaf Ай бұрын
thanks
@philtoa334
@philtoa334 11 ай бұрын
Thx_.
@vitorsouza6604
@vitorsouza6604 6 ай бұрын
That was quite confusing.
@HandyAndyG
@HandyAndyG 11 ай бұрын
That assertEqual, for the first example using requests, is bad code. Testing that the value used in the mock is the value returned from the mocked call is nonsensical. Equivalent to testing that 1 == 1. Useless tests are worse than no tests.
@aflous
@aflous 11 ай бұрын
Not really, you're testing against regressions here. There are so many ways in which the client code could change to break this assumption
@codyswanner6064
@codyswanner6064 11 күн бұрын
Feels like you understand how this works, but you don't understand how to explain it to me. From what I do understand, you seem to be waaaay oversimplifying the example for the sake of speed, when I as a person new to this need things to be a little more fleshed out and verbose to be able to follow what's going on.
@mazaheri.pourya
@mazaheri.pourya 8 ай бұрын
that wasn't good example to teach mock 👎
@Confusedcapybara8772
@Confusedcapybara8772 6 ай бұрын
Can you provide a video for a better one?
Python Tutorial: Unit Testing Your Code with the unittest Module
39:13
Corey Schafer
Рет қаралды 1,3 МЛН
Intro to Python Mocks | Python tutorial
18:42
Red Eyed Coder Club
Рет қаралды 78 М.
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53
Каха ограбил банк
01:00
К-Media
Рет қаралды 3,2 МЛН
Thoughts About Unit Testing | Prime Reacts
11:21
ThePrimeTime
Рет қаралды 207 М.
Pytest Tutorial - How to Test Python Code
1:28:39
freeCodeCamp.org
Рет қаралды 158 М.
Unit Testing in Python
26:25
NeuralNine
Рет қаралды 21 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 791 М.
Debugging 101: Replace print() with icecream ic()
12:36
NeuralNine
Рет қаралды 357 М.
How To Write Unit Tests For Existing Python Code // Part 1 of 2
25:07
Python TDD Workflow - Unit Testing Code Example for Beginners
25:33
Python Simplified
Рет қаралды 73 М.
Modern Python logging
21:32
mCoding
Рет қаралды 153 М.
Advanced Dictionaries: defaultdict in Python
13:12
NeuralNine
Рет қаралды 25 М.
🔥Идеальный чехол для iPhone! 📱 #apple #iphone
0:36
MacBook Air Японский Прикол!
0:42
Sergey Delaisy
Рет қаралды 382 М.