[Zope3-dev] mangled names in tests

Steve Alexander steve@cat-box.net
Sat, 14 Dec 2002 13:51:50 +0200


> The TestIFoo class expect that TestIdempotentFoo is going to define
> some method to return an object implementing IFoo.  The idiom is see
> is to name that method _TestIFoo__new.  This is the mangled form of
> __new in TestIFoo.
> 
> I propose that we change it to _new()

I agree.

> or, in cases where one concrete
> test class will mixin several abstract test classes, _testIFoo().

I don't see why you'd need that. Each test that is mixed in needs the 
same instance. So, _new() will suffice for all of the test classes.

> I think this is much clearer than using a mangled name for something
> that isn't a private name at all.

I agree.

> I haven't found a case where _newIFoo() is actually needed, so maybe
> that's a YAGNI.

I'm pretty sure it is a yagni.

Perhaps _newInstance() or _newObject(), or newInstance() or newObject() 
would be clearer.

--
Steve Alexander