[Zope3-dev] mangled names in tests
Jim Fulton
jim@zope.com
Sat, 14 Dec 2002 08:42:53 -0500
Steve Alexander wrote:
>
>> 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.
No, sometimes you need to test a collaboration among multiple objects.
...
>> 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.
It's not. See, for example:
lib/python/App/OFS/Container/Views/Browser/tests/testContents.py
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org