Unit Tests in Python || Python Tutorial || Learn Python Programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024
  • 𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.... Unit tests are a way to make sure your code is correct. Python comes with a built-in unit test framework that makes it easy to write a lot of tests for your software. In fact, many engineers will write a series of tests before they begin coding. This approach is called “test driven development” and is very effective.
    We are happy to dedicate this video to our new VIP Patron, Juan Guillermo Henao. On a day when we lost 7 Patrons in response to Patreon's new fees, Juan made a generous pledge to keep our video production going! Thank you so much, Juan, for helping us to continue our work!
    To learn Python, start our Python Playlist HERE:
    bit.ly/PythonHe...
    Subscribe to Socratica: bit.ly/1ixuu9W
    ♦♦♦♦♦♦♦♦♦♦
    We recommend:
    Python Cookbook, Third edition from O’Reilly
    amzn.to/2sCNYlZ
    The Mythical Man Month - Essays on Software Engineering & Project Management
    amzn.to/2tYdNeP
    Shop Amazon Used Textbooks - Save up to 90%
    amzn.to/2pllk4B
    ♦♦♦♦♦♦♦♦♦♦
    Ways to support our channel:
    ► Join our Patreon : / socratica
    ► Make a one-time PayPal donation: www.paypal.me/...
    ► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
    Thank you!
    ♦♦♦♦♦♦♦♦♦♦
    Connect with us!
    Facebook: / socraticastudios
    Instagram: / socraticastudios
    Twitter: / socratica
    ♦♦♦♦♦♦♦♦♦♦
    Python instructor: Ulka Simone Mohanty (@ulkam on Twitter)
    Written & Produced by Michael Harrison (@mlh496 on Twitter)
    ♦♦♦♦♦♦♦♦♦♦

ความคิดเห็น • 585

  • @Socratica
    @Socratica  2 ปีที่แล้ว +21

    Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica

  • @unvrknow22
    @unvrknow22 6 ปีที่แล้ว +605

    To quote FDR, "The only thing we have to fear is if Socratica stops making these awesome Python vids."

    • @sevanshahnazaryan743
      @sevanshahnazaryan743 6 ปีที่แล้ว +7

      And they stopped...

    • @euler4513
      @euler4513 6 ปีที่แล้ว +8

      Please don’t stop

    • @aryanmn1569
      @aryanmn1569 5 ปีที่แล้ว +2

      Fears become to reality, it hurts

    • @guilhermehx7159
      @guilhermehx7159 4 ปีที่แล้ว +2

      @@aryanmn1569 they will make more videos soon. They started a campaign to raise funds to make a new series of Python videos

    • @gordontang7837
      @gordontang7837 4 ปีที่แล้ว +1

      for real

  • @Socratica
    @Socratica  5 ปีที่แล้ว +176

    It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

    • @setudutta3905
      @setudutta3905 4 ปีที่แล้ว +2

      You guys are amazing...a revolution in the field of teaching.

    • @URChristiansiuuu7
      @URChristiansiuuu7 4 ปีที่แล้ว +1

      Please we need more such videos, I have never seen how exactly you confess your code,

  • @jameswright4732
    @jameswright4732 6 ปีที่แล้ว +214

    The snarky comments are pretty fantastic.

    • @psSubstratum
      @psSubstratum 3 ปีที่แล้ว +5

      Or in python language: OK

  • @amberstruthers3228
    @amberstruthers3228 2 ปีที่แล้ว +63

    Your videos are such a breath of fresh air in a world where technical videos can get rather dry. So happy I discovered your channel! :)

    • @Socratica
      @Socratica  2 ปีที่แล้ว +7

      We're so glad you've found us!! It can be hard to find the good stuff on TH-cam. It would be a HUGE help if you share our videos and help us get the word out on the Socials!! 💜🦉

    • @cryptodashboard1173
      @cryptodashboard1173 2 หลายเดือนก่อน

      @@Socratica I see lots of teachers giving various lectures but yours is different in presentation. Sometimes I see u as a robot and confused. Are u for real?...great python vids indeed

  • @HomeWreckerGG
    @HomeWreckerGG 6 ปีที่แล้ว +135

    "You've made your point Python" LOL

  • @sortof3337
    @sortof3337 6 ปีที่แล้ว +1132

    Who else watches these videos, even though they already know python?

    • @InternationalBigshot
      @InternationalBigshot 6 ปีที่แล้ว +80

      Who watches these videos and doesn't even know what python is?

    • @namahshrestha3226
      @namahshrestha3226 6 ปีที่แล้ว +38

      I do..for fun..but i walked out with some great info that i missed while i learned python..this is one hell of a tutorial

    • @toshobg
      @toshobg 6 ปีที่แล้ว +4

      it's a Snake

    • @bobfrombilling
      @bobfrombilling 6 ปีที่แล้ว +13

      She cracks me up, love it.

    • @craigbarnett5507
      @craigbarnett5507 5 ปีที่แล้ว +1

      No but I am rewatching these videos tho. They are great!

  • @nothanks7752
    @nothanks7752 6 ปีที่แล้ว +72

    EE just learning python and I've heard the software engineers talk about creating unittests. I didn't even know what they were talking about until this video so thank you very much. Super clear and straight forward.

    • @devn0n
      @devn0n 2 ปีที่แล้ว

      How's it been so far?

    • @leumas4092
      @leumas4092 6 หลายเดือนก่อน

      hows it going?

  • @dameongraham4444
    @dameongraham4444 6 ปีที่แล้ว +44

    “...just okay? Python is stingy with praise!” 🤣 Hilarious...I love it! Great vid! Keep up the great work!

  • @alakerejenus8993
    @alakerejenus8993 2 ปีที่แล้ว +10

    This is the first coding video I'm commenting on, why? It's awesome. From music, presentation, simplicity, pinpoint, beginner-friendly, the mechanic/robotic voice, and humor (sounds like an AI model learning to speak) to delivery. I love this and I can't express it enough.

  • @maroofshittu
    @maroofshittu 6 ปีที่แล้ว +187

    I have never laughed this hard over unit tests. 10 🌟

  • @pranav9421
    @pranav9421 6 ปีที่แล้ว +46

    You explain the concepts in such a simple manner that it makes it easy to learn the rest by myself. And the occasional interspersed dry humor makes the whole lesson more memorizable.
    Please do a video on Python Generators.

  • @alexandersage7035
    @alexandersage7035 5 ปีที่แล้ว +12

    I wish all coding tutorials were of this audio quality.
    Nice unique take on tutorials

  • @pastorhudson
    @pastorhudson 6 ปีที่แล้ว +52

    This is so so good! Your teaching is so clear, and the humor keeps things fun and approachable. You should be very proud of this python series. Thank you!

  • @Maquox
    @Maquox 5 ปีที่แล้ว +54

    "I know, this makes me itch too"
    Totally! hahaha

  • @PunmasterSTP
    @PunmasterSTP 3 ปีที่แล้ว +6

    I think it's safe to say that Socratica has really asserted itself as an organization that puts out free, high-quality and extremely entertaining videos!

  • @johnrine9671
    @johnrine9671 6 ปีที่แล้ว +155

    I do not see a doc string so lets see if we can pass the function a kitchen sink...

    • @theo_st
      @theo_st 6 ปีที่แล้ว +1

      Thank you

    • @jarodlatta6185
      @jarodlatta6185 4 ปีที่แล้ว +3

      QA in a nutshell

  • @melissajade7717
    @melissajade7717 2 ปีที่แล้ว +6

    This lesson was absolutely hilarious, helpful, and beneficial to learning this topic. "Do not fear tests, embrace them". I will think of this every time I am faced with a new one. Thank you, seriously. That is so empowering.

  • @codeisawesome369
    @codeisawesome369 5 ปีที่แล้ว +2

    Holy MOLY, the stylishness of TH-cam programming channels is going off the charts at this point!

  • @bmanishap
    @bmanishap 5 ปีที่แล้ว +68

    Very nice video like watching short science fiction movie !!!!

  • @fleboho
    @fleboho 7 หลายเดือนก่อน +2

    I'm only 1 minute 27 seconds into the video, and am loving it already.

  • @peterlewerin4213
    @peterlewerin4213 5 ปีที่แล้ว +2

    Very many videos about computers and programming are presented in a rambling, introverted manner. Your videos are crisp and expressive, like good source code. (I like the humor as well.)
    Old Shakespeare indulged in quite a bit of cut-and-pasting, but he wasn't wrong about unit tests. You can't live without them, and you live a lot happier with them.

  • @mapa5000
    @mapa5000 4 ปีที่แล้ว +5

    Fun, intelligent, creative...what a beautiful way to teach coding... thank you for this ... I love your work.!

  • @jackdrost9555
    @jackdrost9555 5 ปีที่แล้ว +14

    Yes, obviously I will need to subscribe to this channel. I've never belly-laughed while learning Python.

  • @maryz.r.avecilla4788
    @maryz.r.avecilla4788 4 ปีที่แล้ว +4

    I love the voice, very clear and direct to the point. I have found the right tutorial that fits my learning needs. Thank you so much Socratica. I enjoy all the quotes. You are the best of the best!

  • @AidanofVT
    @AidanofVT 4 ปีที่แล้ว

    I don't know who you are, but I just found this video and your channel will be my first choice for coding help forever.

  • @saeedsedigh1032
    @saeedsedigh1032 5 ปีที่แล้ว +96

    "if type(r) not in [int,float]:"
    That was smart.

    • @zyptoskid
      @zyptoskid 5 ปีที่แล้ว +7

      yeah better than so many "or" statements

    • @OmegaF77
      @OmegaF77 4 ปีที่แล้ว +5

      BIG BRAIN TIME

    • @nlight8769
      @nlight8769 3 ปีที่แล้ว +3

      There are better ways to achieve it actually. With isinstance :
      if not isinstance( r, (int, float) )
      Indeed, if you make a class "INT" that inherits from int like so :
      class INT(int):pass
      *type(INT(5)) == int* would return *False* and not pass the test, while it should.
      Very disapointing ;p

  • @onokr705
    @onokr705 4 ปีที่แล้ว +30

    "Trust but verify with unit testing" - William Shakespeare

    • @emPtysp4ce
      @emPtysp4ce 4 ปีที่แล้ว

      Truly, he was a man ahead of his time

  • @jinxkhoche
    @jinxkhoche 4 ปีที่แล้ว +1

    It sounds like I'm attending a briefing of an inter-galactic mission of utmost importance and am being told of my objectives by an intelligent alien-computer. Brilliant!

  • @dhilanchandrasekara4816
    @dhilanchandrasekara4816 4 ปีที่แล้ว +2

    How am I just discovering this channel now? One of the most entertaining programming tutorials I've ever seen, love your work! :)

  • @bariborsaturday
    @bariborsaturday ปีที่แล้ว

    "Python is stingy with praise"
    😂😂 This is one relaxing python tutorial video I've never come across. This is the best way to learn coding

  • @dantedt3931
    @dantedt3931 5 ปีที่แล้ว +1

    I never thought unit tests would be this fun.She rocks!

  • @vivekjoshi3769
    @vivekjoshi3769 10 หลายเดือนก่อน

    Got curious about Unit Tests after somebody mentioned in a community.
    Watched some videos before this one.
    I promise you nowhere I got such clear & concise explanation especially with python code on the screen.
    Some people are born with the ability to make things easier to understand for the world.
    Big Salute to the lady & her Team!

  • @dreamphoenix
    @dreamphoenix 4 ปีที่แล้ว +2

    Your commentary is priceless. "You have got to be kidding me."
    My old physics teacher and you would get along quite well. :)

  • @yash1152
    @yash1152 ปีที่แล้ว

    thats the power of firdt impressions - i saw your one video for the first time about python list comprehensions months ago.
    and today, while searching for python unit tests, other videos i "saved to watch later" - but ur video came, i immediately opened in new tab.

  • @georgesmith3022
    @georgesmith3022 5 ปีที่แล้ว +35

    I never test my code, but when i do, i do it in production

  • @DUANEYAISER
    @DUANEYAISER 6 ปีที่แล้ว +53

    There's much to love about this series, but I especially love that you use vim. :-)

  • @ssr142812
    @ssr142812 2 ปีที่แล้ว

    I was still in shock and staring at her even after watching 5+ videos! Really a different kind of learning and experience! kudos

  • @MyTube4Utoo
    @MyTube4Utoo 6 ปีที่แล้ว +36

    A new Socratica Python video! YAY! Christmas came early!

  • @vigajad7677
    @vigajad7677 2 หลายเดือนก่อน

    It was a pleasure to watch and learn, I just got to write my first python tests in a project and now I'm much less scared of the task :')

  • @mrush336
    @mrush336 5 ปีที่แล้ว +3

    I love the humor. Also very enlightening for me as a beginner. Keep up the good work!

  • @archstampton5910
    @archstampton5910 5 ปีที่แล้ว +33

    The function is, how should I say this politely ... "A grave disappointment"

  • @TommyAMV
    @TommyAMV ปีที่แล้ว

    I absolutely love you humor! Not to mention I actually understood the topic well enough to implement it in practice, unlike during other 30+ minute vids. Keep up the great work!

  • @ArizonaJewell
    @ArizonaJewell 3 ปีที่แล้ว

    I'm currently finishing up a course on object oriented programming in Python. I didn't really get the lecture on testing, and this is BY FAR one of the best videos I could've asked for for learning Python. It's short and sweet, so I don't need to watch some 40 minutes video.

  • @MyTube4Utoo
    @MyTube4Utoo 6 ปีที่แล้ว +9

    This one was a little over my head, but now I know what I need to study.

  • @nguyenduy-sb4ue
    @nguyenduy-sb4ue 5 ปีที่แล้ว +1

    OMG ! !! the quality of your work is insane !! I really enjoy your videos, please make more

  • @Amakratacjan
    @Amakratacjan 5 ปีที่แล้ว +2

    That's trippy in a Command and Conquer game way. Awesome

  • @davidajimati980
    @davidajimati980 ปีที่แล้ว

    My bootcamp reccommended your video (not the Docs) Wow!
    I'm amazed, you amazed.
    I'm happy to find your channel

  • @camilofunez4209
    @camilofunez4209 2 ปีที่แล้ว

    I just discovered this wonder, and OMG! i feel like a kid with a new toy. This video is AMAZING!. thanks

  • @89Valkyrie
    @89Valkyrie 6 ปีที่แล้ว +1

    Every student should watch your videos. Amazing knowledge presented in an incredibly creative, cringe-less, way. Instantly subscribed.

  • @cpgautam172
    @cpgautam172 4 ปีที่แล้ว

    thank you for telling how to check all the different assertions, many times my prof would tell us examples for few, and in the exam we only get those few problems. but when solving various problems, it overwhelming how much we dont get taught, at least here u r showing a good place to start.

  • @diallomamadou258
    @diallomamadou258 4 ปีที่แล้ว

    A frontend Developer loving the way you explain things, just subscribed.

  • @robertb5357
    @robertb5357 3 ปีที่แล้ว

    Love her sense of humor and delivery. :)

  • @MustbeTheBassest
    @MustbeTheBassest 6 ปีที่แล้ว +13

    I love this damn channel. Seriously, this helps me out so much!

  • @michaelsvoboda1024
    @michaelsvoboda1024 6 ปีที่แล้ว

    Why did it take so long to find this exceptional channel? Great format.

  • @quantadotonium3654
    @quantadotonium3654 2 ปีที่แล้ว

    What an entertaining and exciting way of descriptions of concepts. Besides, the actual content, her sarcasm makes my day! Well done AI!

  • @ruixue6955
    @ruixue6955 3 ปีที่แล้ว +4

    2:18
    2:32 your typically put the unit tests into a separate file
    3:08
    3:37 unit test code demo
    4:39 run unit test: python -m name_of_test.py

  • @johnmalek187
    @johnmalek187 2 ปีที่แล้ว

    Great way to teach concepts in Python. I love your humor.

  • @nishadt
    @nishadt 2 ปีที่แล้ว

    This is phenomenally creative script .. I would like to touch the feet of the creator (hats off).

  • @FabianBarajas
    @FabianBarajas ปีที่แล้ว

    omg these are so good. Clear and concise lessons with some hilarious commentary.

  • @jonsnow208
    @jonsnow208 4 ปีที่แล้ว

    Congratulations!
    I am a very scattered person, but with this teaching form i am absolutetly concentrated only in the video

  • @vincentkizza3751
    @vincentkizza3751 3 ปีที่แล้ว

    Jesus! What a tutorial! Never seen anything like it,I cannot wait for more. Many many thanks.

  • @otaorojuolalekan5978
    @otaorojuolalekan5978 ปีที่แล้ว

    "OK"
    "just OK"
    "Python is stingy with praise."
    That cracked me up

  • @rahul-qo3fi
    @rahul-qo3fi 3 ปีที่แล้ว +1

    To the point, no bullshit!! Brilliant!!

  • @jennyada1429
    @jennyada1429 2 ปีที่แล้ว

    This is the best tutorial I have ever seen.

  • @dangelos3143
    @dangelos3143 4 ปีที่แล้ว

    Best Python tutorial in history.

  • @michaelodhiambo2791
    @michaelodhiambo2791 2 ปีที่แล้ว

    I almost forgot I was watching a tutorial and grabbed the popcorn.

  • @andre-barrett
    @andre-barrett 4 ปีที่แล้ว

    I enjoyed this video. I'm a big advocate of unit testing and even though I don't do any Python programming yet, I believe the principles are the same across most languages

  • @alecteucilide2234
    @alecteucilide2234 2 ปีที่แล้ว

    Beautiful voice, excellent diction and lovely (and educational) presentation. Great job!

  • @emekaemodi3991
    @emekaemodi3991 ปีที่แล้ว

    The program I'm in referenced this channel to go learn the basics of unit testing and with what I've seen Oh Boy, I'm definitely checking out the rest of the contents in this channel. Sci-fi swag and has very concise explanations I love it

  • @NguyenTran-eq2wg
    @NguyenTran-eq2wg 2 ปีที่แล้ว

    I HAVE TO SAY THIS IS BRILLIANT!

  • @benjaminmayanja7452
    @benjaminmayanja7452 5 ปีที่แล้ว +3

    You make programming so cool and hilarious.
    Made my morning.

  • @lightyearahead
    @lightyearahead 4 ปีที่แล้ว +1

    This is both funny and knowledgeable content. Love this series.

  • @aryaparvizi8755
    @aryaparvizi8755 2 ปีที่แล้ว

    this video is BRILLIANT lol. hilarious enjoyable while learning a thing or two. loved it

  • @nayyerabbas7174
    @nayyerabbas7174 4 ปีที่แล้ว

    One of the best python tutorials. Please upload python tutorials with Object Oriented Programing.

  • @tylerwelch7472
    @tylerwelch7472 6 ปีที่แล้ว +1

    These videos are great! I've read a few python books, and followed along with a few different courses, and you're videos have made me actually "understand" the topics you cover.
    Love it! Keep it up !

  • @DaniloSilva-pl3sq
    @DaniloSilva-pl3sq 2 ปีที่แล้ว

    I'd never imagine unit tests were so easy and simple!

  • @manuelpineda9067
    @manuelpineda9067 2 ปีที่แล้ว

    It's amazing how exciting the video makes a subject as unit tests seem.

  • @guilhermehx7159
    @guilhermehx7159 5 ปีที่แล้ว

    I am amazed of how fast i learnt from these videos when compared to other courses. fast and easy

  • @NathanPatnam
    @NathanPatnam 6 ปีที่แล้ว

    Enjoyed the video and wanted to add two things to it. Say you had a unit test file named test_foo.py you don't have to do 'python -m unittest test_circles' , you can just type in 'python test_foo.py' in your terminal and all the unit tests will run and be displayed. Additionally, if you had a piece of code that you wanted to happen before every unit test started you can write a function 'def setUp():' and any code you write in this function will take place before each unit test. Additionally, you can write a function 'def tearDown():' and any code in here will take place after each unit test. Just wanted to add more value to the video.

  • @fordfactor
    @fordfactor 4 ปีที่แล้ว

    I've started watching some videos from this channel. They are clear, concise and funny!

  • @_mvr_
    @_mvr_ 6 ปีที่แล้ว

    i didnt even know python complex numbers were a thing. Bonus info! This series is great

  • @harrybarrow6222
    @harrybarrow6222 5 ปีที่แล้ว +1

    I absolutely loved this video, so of course, 👍 and Subscribed + 🔔.
    It really held my attention, made me laugh, and taught me a lot.
    I am an experienced programmer and I have been looking for a Python tutorial series that would not send me to sleep.
    Thank you, Socratica, I have just started your Python course. 😀

  • @Erin-bc8ic
    @Erin-bc8ic 5 ปีที่แล้ว

    Holy shit this is amazing. Very clearly, functional and with a small dash of humor with an excellent voice.

  • @sherif_a
    @sherif_a 4 ปีที่แล้ว +2

    "Change is one constant in programming... do not fear tests, embrace them."

  • @AnsonSavage
    @AnsonSavage 2 ปีที่แล้ว

    Haha, this is incredible! This is the first I've seen of your videos and you made some jokes that took me a long time to stop laughing from, haha. Keep up the great work!

  • @vladimirrav
    @vladimirrav 4 ปีที่แล้ว +1

    I liked your videos a lot, the best tutorial series I've ever seen. It is very exciting to watch.
    It would be very nice to have a complete data science tutorial like this with statistics, probability and so on.
    Keep the outstanding work, we'll appreciate it!!!

  • @aymankurdi6807
    @aymankurdi6807 4 ปีที่แล้ว

    Really a very creative way of teaching, why we didn't have these kind of teachers in college 😡

  • @retrofutur1st
    @retrofutur1st 3 ปีที่แล้ว

    Way to make a challenging topic entertaining, big props! I'll be incorporating unit testing into my coding from here on out.

  • @abdulrahmanalmowafy5350
    @abdulrahmanalmowafy5350 6 ปีที่แล้ว

    I don't care much for python but I've watched every video in this series. I'm kinda hypnotized by Ulka :D

  • @ricardohincapie1537
    @ricardohincapie1537 4 ปีที่แล้ว

    Fantastic, simply fantastic. Your concept is so fun!

  • @Peter-tf2uc
    @Peter-tf2uc 9 หลายเดือนก่อน

    This is amazingly simple explanation

  • @Goodhealthall2015
    @Goodhealthall2015 4 ปีที่แล้ว

    Loving this unique sarcastic style of videos.

  • @HP-ol2ux
    @HP-ol2ux 5 ปีที่แล้ว

    You are really great. People rarely combine education with humor in such good way. Very nicely done :)

  • @prlombaard
    @prlombaard 6 ปีที่แล้ว

    As always @Socratica, short simplistic videos, that cuts right to the chase and explains a topic in Python in a very concise manner, giving the Viewer just enough to satisfy the initial curiosity,which prompts the Viewer to then to go study more.

  • @francktchamo2350
    @francktchamo2350 2 ปีที่แล้ว

    I like the way you exposed unit test. The first time I hear about this concept of unit test, I said why are you disturbing us with test. But today it's different

  • @Kanephan
    @Kanephan 3 ปีที่แล้ว

    Excellently written and explained

  • @erintracey6554
    @erintracey6554 2 ปีที่แล้ว

    These videos are not only educational, but fun! Thank you

  • @Kevin-zk7xc
    @Kevin-zk7xc 4 ปีที่แล้ว

    One of the funniest and best tutorial I've ever watched

  • @shivambajpeyi9008
    @shivambajpeyi9008 4 ปีที่แล้ว

    ohh God you solved my problem on which i stucked since 2 days .....love uhh