Test-Driven Development in Python: Test First Code Later

  Рет қаралды 10,316

NeuralNine

NeuralNine

7 ай бұрын

Today we learn about test-driven development and how to easily do it in Python.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 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

Пікірлер: 26
@mehdimojaradi
@mehdimojaradi 7 ай бұрын
I have been waiting for this concept with your elequent way of teaching. Thanks indeed not only for this episode but also for all other ones.
@NLCircle
@NLCircle 7 ай бұрын
NeuralNine, thank you for another high quality, conchise and clear introduction to a Python feature. Extremely helpful and I like to comment you for the way you break down the 'problem' and turn it into a tutorial on how to approach this myself.
@zackplauche
@zackplauche 7 ай бұрын
One question from the beginning: How is building a calculator class the first step if you're supposed to write your test first then code?
@pablocastaneda4021
@pablocastaneda4021 5 ай бұрын
intro is sooo good! I would buy for a ringtone!
@13137713
@13137713 5 ай бұрын
Thanks, it was really helpful! I've just learnt this TDD thing and wanted to try and implement it myself in my hobby project.
@BrandonNewell222
@BrandonNewell222 7 ай бұрын
this is really well done thank you. I would love it you did more on TDD
@ScriptRaccoon
@ScriptRaccoon 7 ай бұрын
I prefer using pytest since I don't have to write the boilerplate as with the unittest module. Also, the combination with pytest-cov gives nice coverage reports.
@donewithwork
@donewithwork 7 ай бұрын
Awesome tutorial. Thanks :)
@user-hx1ju5ox9v
@user-hx1ju5ox9v 7 ай бұрын
Dude, i am studying at ITMO in Russia, and I really want to thank you for the video, python tests are my homework)
@jparks6544
@jparks6544 5 ай бұрын
If you are going to do this type of thing, you should really use the testing package that is the most popular. unittest is VERY old.
@holthuizenoemoet591
@holthuizenoemoet591 7 ай бұрын
would the statement if not instanace(x, int) and not instance(x, float) be always false in the case of a number?
@TheMCEnthusiastPlays
@TheMCEnthusiastPlays 7 ай бұрын
it sorta depends on your definition of a number, but yes, usually the statement will be false if you pass a valid number for x. this /may/ not always be true though. if you're using numpy, or another library that includes different classes for representing numbers other than the built-ins, you could find yourself in a situation where you're expecting a default float and you pass it a numpy.double and you would raise a TypeError. you should not run into this problem a whole lot, since you should know what data types you're passing as arguments, but if you're learning a new library or you're just working on some funky code with weird numerical types, but it's something worth paying attention to
@zapy422
@zapy422 Ай бұрын
How to define test dependencies?
@arkadiuszpaterak
@arkadiuszpaterak 7 ай бұрын
Which in your opinion is better, unittest or pytest?
@krzysiekkrzysiek9059
@krzysiekkrzysiek9059 7 ай бұрын
Pytest offers more functionality and its more intuitive for me. I use it for WebDev within Selenium.
@duftcola
@duftcola 7 ай бұрын
I have to say that while in theory this a good way of making things I find often that testing doenst allow you to keep up the speed of the project and at the I just end up running the application and see what crashes and a folder full of unitest that became outdated
@GSK-Tech
@GSK-Tech 7 ай бұрын
but if we follow SOLID Principles from start , we can control outdated issues
@no-wl4qw
@no-wl4qw 7 ай бұрын
​@@GSK-Techfollow the principle would make those unitests still valid, but it's coverage is so little as the project grow so fast that you won't able to make test for every unit.
@chriskeo392
@chriskeo392 7 ай бұрын
​@@no-wl4qwyupp
@GSK-Tech
@GSK-Tech 7 ай бұрын
@@no-wl4qw thats the reason we implement design Architectures and divide things in modules if our project is too large. Yes it turns into complex file and trees but everything is loose coupling and easy to refactor.
@ScriptRaccoon
@ScriptRaccoon 7 ай бұрын
This is not a problem with unit testing. It shows that unit testing hasn't been properly implemented in the team. Otherwise you would not suddenly have failing tests (of course, they should run in the CI, and all new features get tests).
@JorgeEscobarMX
@JorgeEscobarMX 7 ай бұрын
magic mocks and patch next?
@holthuizenoemoet591
@holthuizenoemoet591 7 ай бұрын
How to do this but with notebooks?
@philtoa334
@philtoa334 7 ай бұрын
Thx_.
@TianMuYe
@TianMuYe 7 ай бұрын
Where is vim😢
Debugging 101: Replace print() with icecream ic()
12:36
NeuralNine
Рет қаралды 359 М.
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 15 МЛН
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 445 М.
Transfer Complex Python Objects via Sockets
13:36
NeuralNine
Рет қаралды 9 М.
Auto-Stop Algorithms with Multiprocessing in Python
8:39
NeuralNine
Рет қаралды 4,6 М.
Garbage Collection in Python: Speed Up Your Code
16:41
NeuralNine
Рет қаралды 14 М.
Test Driven Development - What? Why? And How?
17:14
Continuous Delivery
Рет қаралды 84 М.
AsyncIO & Asynchronous Programming in Python
12:28
NeuralNine
Рет қаралды 149 М.
Speed Up Data Processing with Apache Parquet in Python
10:12
NeuralNine
Рет қаралды 8 М.
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 269 М.
🚀  TDD, Where Did It All Go Wrong (Ian Cooper)
1:03:55
DevTernity Conference
Рет қаралды 551 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,7 МЛН
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 3,4 МЛН
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 10 МЛН