Professional Python Testing with Mocks

Поділитися
Вставка
  • Опубліковано 2 лип 2023
  • 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 9 місяців тому +1

    This is now my GO TO channel for python. Absolutely top class tutorials!

  • @justmogen7383
    @justmogen7383 8 місяців тому +1

    the explanation from beginning is awesome mahn! Very concise

  • @sadikplayz976
    @sadikplayz976 Рік тому +8

    This channel is underrated AF!

  • @joaovitorfrossard7317
    @joaovitorfrossard7317 4 місяці тому +1

    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.

  • @JorgeEscobarMX
    @JorgeEscobarMX Рік тому +5

    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.

  • @highradqa
    @highradqa Місяць тому

    You're my champion from now on dude. Great vid !!!!!!!

  • @ButchCassidyAndSundanceKid
    @ButchCassidyAndSundanceKid Рік тому +1

    Very well explained. Thanks.

  • @mohitmansi11
    @mohitmansi11 5 місяців тому

    Very well explained. Please come up with more such videos and examples. Thanks .

  • @geordiehowell9087
    @geordiehowell9087 8 місяців тому

    such great explanation. thank you

  • @allandasantos9680
    @allandasantos9680 7 місяців тому

    Very good. I would like to see more videos about mocks but using magic mock

  • @JorgeEscobarMX
    @JorgeEscobarMX Рік тому

    A little chaotic and the examples were very well done.

  • @eugenmalatov5470
    @eugenmalatov5470 2 місяці тому +1

    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?

  • @thee_apedo_guy
    @thee_apedo_guy 3 місяці тому

    That was sensational, feeling 🏋️‍♀️🏋️‍♀️

  • @CristianMolina
    @CristianMolina 5 місяців тому

    Also, to test error conditions it's great to use mocks on the dependencies

  • @dsinghr
    @dsinghr 2 місяці тому

    this was very helpful. Is there a follow up video for more such examples? thanks

  • @Deepu1014
    @Deepu1014 6 місяців тому +1

    What is MagicMock? Can you show small demo with it?

  • @alavvaf
    @alavvaf Місяць тому

    thanks

  • @vitorsouza6604
    @vitorsouza6604 6 місяців тому +2

    That was quite confusing.

  • @philtoa334
    @philtoa334 Рік тому

    Thx_.

  • @HandyAndyG
    @HandyAndyG Рік тому +3

    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 Рік тому +2

      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 23 дні тому

    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 місяців тому +4

    that wasn't good example to teach mock 👎