Say I have a python function called sample(). It takes no arguments. It returns a dictionary in the end though. How can I perform unit testing for such a function ? Can I test it with status code like 200 ? How can i test if the function is written correctly ?
A plain python function has no status code. Status codes are a part protocols like of HTTP.
Your test can call the function and check if the result is a dictionary. Without knowing anything more about your function this is the only thing I can suggest.
How to unittest a python function that takes no arguments?