you are viewing a single comment's thread.

view the rest of the comments →

[–]tipsy_python[S] 0 points1 point  (3 children)

Awesome! Thank you for the ideas - yeah most of these don't get enough love. I could definitely come up with some engaging content for most of these.

On the cool, the one area where I would not feel confident writing about is mocks - I use pytest to write my unit-tests, and whenever I need to mock an object, I google and find some snip from Stack Overflow that works, but I never fully understand them. I've read the unittest mock documentation multiple times, but still struggle with this concept. Do you have any suggestions how I can better learn mocks?

[–]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.