[TIP] new test parametrization / deprecating "yield"

Michael Foord fuzzyman at voidspace.org.uk
Fri May 15 02:31:01 PDT 2009


Douglas Philips wrote:
> On 2009 May 14, at 3:55 PM, Michael Foord wrote:
>   
>> I like the decorator syntax. I've updated my recipe to use it. :-)
>>
>> http://code.google.com/p/unittest-ext/source/browse/trunk/params.py
>>     
>
> If I grok right, the metaclass will actually inject new synthetic test  
> methods into the class definition?
>
>   
Right.

> I'm also not real clear on why the synthetic method (test, until it is  
> given a new .__name__ and stored in the class under a new name) cannot  
> just call 'item' instead of doing getattr (you'd still need to do the  
> closure hack of having an 'item=item' optional parameter the way you  
> do with name). But its late here and maybe I'm just not seeing  
> something obvious...
>   

item is the unbound method. getattr returns the bound method. I guess it 
could call item(self, **args) but that code is actually unchanged from 
the previous version...

Michael

> -Doug
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the testing-in-python mailing list