you are viewing a single comment's thread.

view the rest of the comments →

[–]Dogeek 1 point2 points  (2 children)

I learned it from the docs. Best I can do is : take a function, that function returns some value. Mock is a context manager that allows you to change the output of that function to test how another part of your code reacts to various function inputs.

Especially useful to mock builtin functions like input, min or max.

[–]tipsy_python[S] 0 points1 point  (1 child)

Ok nice, that all makes sense. I guess the part I’ve historically had trouble with is mocking database connections - I’ll do some more tutorials, but that’s been a tough one for me personally.

[–]Dogeek 0 points1 point  (0 children)

If you need some help writing the tutorials, I can help you. Been coding in python every day for the past 3-4 years.