mocker(which is also the name of the package) as a variable inside the example, so you get double frustrated.
here is the example directly taken from the documentation of the library:
>>> mocker = Mocker()
>>> obj = mocker.mock()
Traceback (most recent call last):
mocker.MatchError: [Mocker] Unexpected expression: obj.bye
the first weird thing is also the first line of the example code:
mocker = Mocker()
the second one is also the second line of the example code:
obj = mocker.mock()
all right, I can see that because the statement
mockernow corresponds to a
mocker.mock()should be returning a mock object (did you get my frustration, mocker mock Mocker Mock, wtf!)
what those guys written this documentation has forgotten should be a line of:
from mocker import *
and knowing this really doesn't help me too much, cause I don't code in this way. Really, who is importing everything to the module namespace should be doing something evil.
and also using the package name as a variable to hold an object which is produced by one of the classes of that package means you are really shitting in the namespace...
and I see a lot of this kind of namespace killer statements in package documentations, I think they think that is much clearer, but it is wrong, cause it really breaks the way I construct things in my mind.
I'm frustrated... or am I missing something...
As muhuk warned me about contributing an OpenSource package before complaining about its defects I created a bug report explaining my concerns. You can find the bug report here:
I need to thank to muhuk