[pypy-dev] custom classes in applevel tests

Timo Paulssen timo at wakelift.de
Sun Apr 29 01:45:42 CEST 2012

Hello there,

I was writing a few test cases for numpypy to make sure it behaves like numpy 
does when confronted with objects that have either an __int__, an __index__ or 
both (rule of thumb: index is prefered, but int is accepted in absence of index).

Now, I wrote six tests that use three custom objects (one set for getitem, one 
set for setitem and one test each for int only, int and index and index only).

I couldn't put those classes outside the applevel test (this is about 
pypy/module/micronumpy/test/test_numarray.py btw) because there's some kind of 
separation going on there. I *thought* the way to do it was to put it inside the 
applevel test class and have its name start with w_, but that wasn't it either.

How do I make this work? Currently I have copies of the classes in each of the 
tests, but I'd like to clean this up.

After this test cleanup, I think the branch numpypy-issue1137 is ready to be 
merged. Buildbot seems to agree.
   - Timo

More information about the pypy-dev mailing list