# HG changeset patch # User Frederic Bastien # Date 1210104757 14400 # Node ID e1a004b21daa2dcb8fe032f1e5c2f01cce375f6e # Parent a90d85fef3d43596b49dc40fa648be1366332e93 more test diff -r a90d85fef3d4 -r e1a004b21daa test_dataset.py --- a/test_dataset.py Tue May 06 16:07:39 2008 -0400 +++ b/test_dataset.py Tue May 06 16:12:37 2008 -0400 @@ -124,6 +124,7 @@ i=0 mi=0 m=ds.minibatches(['x','z'], minibatch_size=3) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for minibatch in m: assert len(minibatch)==2 test_minibatch_size(minibatch,m.minibatch_size,len(ds),2,mi) @@ -137,6 +138,7 @@ i=0 mi=0 m=ds.minibatches(['x','y'], minibatch_size=3) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for minibatch in m: assert len(minibatch)==2 test_minibatch_size(minibatch,m.minibatch_size,len(ds),2,mi) @@ -152,6 +154,7 @@ i=0 mi=0 m=ds.minibatches(['x','z'], minibatch_size=3) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for x,z in m: test_minibatch_field_size(x,m.minibatch_size,len(ds),mi) test_minibatch_field_size(z,m.minibatch_size,len(ds),mi) @@ -177,27 +180,32 @@ #not in doc i=0 - for x,y in ds.minibatches(['x','y'],n_batches=1,minibatch_size=3,offset=4): + m=ds.minibatches(['x','y'],n_batches=1,minibatch_size=3,offset=4) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) + for x,y in m: assert len(x)==3 assert len(y)==3 for id in range(3): assert (numpy.append(x[id],y[id])==a[i+4]).all() i+=1 assert i==3 - del x,y,i,id + del x,y,i,id,m i=0 - for x,y in ds.minibatches(['x','y'],n_batches=2,minibatch_size=3,offset=4): + m=ds.minibatches(['x','y'],n_batches=2,minibatch_size=3,offset=4) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) + for x,y in m: assert len(x)==3 assert len(y)==3 for id in range(3): assert (numpy.append(x[id],y[id])==a[i+4]).all() i+=1 assert i==6 - del x,y,i,id + del x,y,i,id,m i=0 m=ds.minibatches(['x','y'],n_batches=20,minibatch_size=3,offset=4) + assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for x,y in m: assert len(x)==3 assert len(y)==3