Hi guys,<br><br>Here is a simple function.<br><br>def readfile(*args, **kwargs):<br>    local = kwargs.get(&#39;local&#39;, os.getcwd())<br>    filename = args[0]<br>    f_path = os.path.join(local, filename)<br>    with open(f_path, &#39;r&#39;) as f:<br>
        return f.read()<br><br><br>Now here is just ONE case of the readfile test code. For readabilty, I will put in <a href="http://pastebin.com">pastebin.com</a><br><a href="http://pastebin.com/P45uc2TV">http://pastebin.com/P45uc2TV</a><br>
<br>I am verifying how many times X Y C dependencies are called and what parameters are passed to them. I think these are necessary to check (what if one of the dependency functions called with the wrong variable).<br><br>
But is this really the nature of unittest? I&#39;ve read many tests code and they all seen to be 5-20 lines..... I faint when I am reading my test code.............. SIGH<br><br>I have some 10 lines function and it took 50 lines to test! Let alone for each of these functions, I need to write a a few tests for each branch case...<br>
So if there are 10 functions, each 5 lines, I can end up with 1000 lines of test code....<br><br>Last question, I find my patching is really really long and inconvince. How should I patch (say they all come from os package)?<br>
<br>Thanks.<br>John<br>