Python Tutorial: Unit Testing Your Code with the unittest Module

preview_player
Показать описание
In this Python Programming Tutorial, we will be learning how to unit-test our code using the unittest module. Unit testing will allow you to be more comfortable with refactoring and knowing whether or not your updates broke any of your existing code. Unit testing is a must on any large projects and is used by all major companies. Not only that, but it will greatly improve your personal code as well. Let's get started.

The code from this video can be found at:

Unittest assert methods:

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python
Рекомендации по теме
Комментарии
Автор

I think you deserve roughly half of my salary, since your videos brought me into software development ;)
Keep up that good work

martinmusli
Автор

The best place to learn python! videos like these add value to internet :-)

siddharthsonone
Автор

6 years in, and this vid is still at its best. Thank you Corey. You're awesome

ernestessien
Автор

You're great Corey. With use of simple code editor You can explain complicated things. No greenscreen, no slides, just calm and pure explanations. English is a foreign language to me, but Your videos are so understandable, that this is not a problem. Once again thank You very much.

hubertcombomarketing
Автор

11:04 you can select add then press ctrl+d to select same word in lines below and then type to use multiple cursor to edit all words together.

desihaxor
Автор

in my country, there's an old saying for people with good explanations, "they give you the soup straight to your mouth with a spoon.". This is what are you actually doing I mean a very simplified explanation that even a naive would understand. Thanks for the effort and time you put in those tutorials, I wouldn't have got any of this without them.

hasanfares
Автор

This is just plain glorious. If there's such a thing as falling in love with code, this has got to be it. I enjoyed every moment of it. You're amazing, Corey, and you did a wonderful job of very clearly explaining all of it. From where I sit, you created a masterpiece of art. It's simply amazing. Test-driven development, here I come.

elliria_home
Автор

Corey is so good explaining that he doesn't think what he says, he goes smooth with the knowledge. Legend

Sugurous
Автор

It was a really very good moment when I found this channel. Such good, clear and no-nonsense explanations.

IAhmed
Автор

Bro, thank you so much. I am a python beginner and these tests were just giving me headaches. After watching this? I am not so uneducated anymore. Thank you and keep up the good work.

ferdinandbada
Автор

Corey, I took 3 C/C++ classes at UCSD Extension a few years ago and recieved 3 A's from 2 of the toughest professors at the University. I've watched a dozen of your Python videos and you are even better at teaching programming.

nox
Автор

am 17 and i think if somehow i manged to make a good career in this field, its all goes upto u sir.... and i wnna say that, cuz ain't able to give u any fund but i always watch the ad till the end..even if its 2 min long..

GOD BLESS U SIR

swayam
Автор

What kind of losers would dislike this video? Corey you are a time saver. Thanks for sharing with us the fruit of your hard work. You are one of the reasons why I am able to crack interviews and also deliver quality code at my work. Thank you once again.

sudarsandm
Автор

@21:40 DRY - create objects once
@22:22 - setup and teardown methods
@25:00 - teardown
@26:53 - the setup and teardown run before and after every single test what is the way to run something once at the start?
@29:00 - how to deal with stuff we have no control over
@29:15 - mocking

TJKhara
Автор

Fantastic videos. I would add that the test cases can be spread across multiple classes. This allows you to group tests together so that you can make good use of setUp() and setUpClass(). For example, if you have multiple tests that require a database, you could group all those tests into a single class and have the setUpClass() method prepare the db. Tests that don't involve the db would go into other test classes. The larger the overall project, the more test classes you are likely to have.

garybloomlaw
Автор

Thank you. SO much better than paid videos.

riskzerobeatz
Автор

I am looking at all of your videos and as your videos are old, I thought lot of comments must be old. But to my surprise I see lot of latest comments which indicate lot of people still following these videos. Cheers to you bro.! I am experienced in Python and really these are the most simple and clear videos I have ever seen.! Your examples are mostly real time scenarios and they are very simple so that everyone can understand. Keep up the good work..!

gouthamanush
Автор

Corey is so good explaining that he doesn't think what he says, he goes smooth with the knowledge.

kondaveetikrishnachaitanya
Автор

I made my first python project without implementing a test. Judging from my experience it was really rough, It took me a lot of late night sleep just to see if a feature works the way I intended. Now I am learning testing and trying to apply it in my current project.

I hope I had learn testing earlier, before proceeding to create my project.

The video uses unit test, while mine was pytest, but hoping the concepts I learn here is same to be applied in pytest.

Appreciate videos like these are created for free to everyone.

Karlkkaaarrll
Автор

I have already watched many videos on the internet and going through various online courses (paid ones too), and I must say this channel has the best Python videos, from beginner to advanced topics. Thank you very much!

fabioPatroni
visit shbcf.ru