# HG changeset patch # User Frederic Bastien # Date 1210871421 14400 # Node ID b9950ae5e54bc7909593be5efb31f9a1f220bcba # Parent c9c966cab763b5b665c15d33716fb299dec01a64 Added test for ApplyFunctionDataset diff -r c9c966cab763 -r b9950ae5e54b test_dataset.py --- a/test_dataset.py Thu May 15 13:09:26 2008 -0400 +++ b/test_dataset.py Thu May 15 13:10:21 2008 -0400 @@ -458,7 +458,18 @@ def test_ApplyFunctionDataSet(): print "test_ApplyFunctionDataSet" - raise NotImplementedError() + a = numpy.random.rand(10,4) + a2 = a+1 + ds1 = ArrayDataSet(a,LookupList(['x','y','z'],[slice(3),3,[0,2]]))###???tuple not tested + + ds2 = ApplyFunctionDataSet(ds1,lambda x,y,z: (x+1,y+1,z+1), ['x','y','z'],minibatch_mode=False) + ds3 = ApplyFunctionDataSet(ds1,lambda x,y,z: (numpy.array(x)+1,numpy.array(y)+1,numpy.array(z)+1), ['x','y','z'],minibatch_mode=True) + + test_all(a2,ds2) + test_all(a2,ds3) + + del a,ds1,ds2,ds3 + def test_FieldsSubsetDataSet(): print "test_FieldsSubsetDataSet" raise NotImplementedError() @@ -479,4 +490,5 @@ test_LookupList() test_ArrayDataSet() test_CachedDataSet() + test_ApplyFunctionDataSet() #test pmat.py