To mock or not to mock?
I will explain to you what "mock" means in dev-speak and why you'd want to do it.
On a WhatsApp group that houses a community of data science and machine learning developers, I asked a question concerning the ability to mock an excel file. Turns out not everyone knows what "mock" means in dev-speak.
What is "mock"?
To explain this, we need a context. We've got Isaac who's desperately in need of money and has decided quite sadly to follow the path of money ritual to achieve his aim. Except his path is not what we can imagine...
He wants to take over Babalawo jobs by automating their work. He, being a developer creates a function that does something like so:
from typing import (
Human, # doesn't really exist
BodyPart, # doesn't really exist
Dict
)
def prepare_sacrificial_being(person: Human) -> Dict[str, BodyPart]:
head, mid, legs = *Human
result = {
"head": head,
"mid": mid,
"legs": legs
}
return result
Problem
Now Isaac wants to confirm that his function works. How can he do this without any of us being his victim?
Solution
What Isaac can do is to mock (create something that can replace) a human being instance and pass it to the function. That way he can confirm the function really commits murder without using real humans.
Conclusion
Yeah, so that's what "mock" is all about. Now you can waltz about communities throwing the fancy word about. If you're writing a real money ritual API, the use-case above will be very helpful.
Disclaimer: Isaac may exist, but his mission, goal, aim and objective isn't real. Neither is the function, prepare_sacrificial_being
or the datatypes: Human
and BodyParts
. In addition, I am not responsible for the actions of those who might want to replicate such a mechanism.
Sleep well, child...