Mercurial > pylearn
comparison _test_dataset.py @ 312:96cca78de3ed
still something weird in the getitem test
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Wed, 11 Jun 2008 13:22:00 -0400 |
parents | 0690de82c338 |
children | b48cf8dce2bf |
comparison
equal
deleted
inserted
replaced
311:0690de82c338 | 312:96cca78de3ed |
---|---|
265 assert len(ds)==len(index) | 265 assert len(ds)==len(index) |
266 for x,z,y in ds('x','z','y'): | 266 for x,z,y in ds('x','z','y'): |
267 assert (orig[index[i]]['x']==array[index[i]][:3]).all() | 267 assert (orig[index[i]]['x']==array[index[i]][:3]).all() |
268 assert (orig[index[i]]['x']==x).all() | 268 assert (orig[index[i]]['x']==x).all() |
269 assert orig[index[i]]['y']==array[index[i]][3] | 269 assert orig[index[i]]['y']==array[index[i]][3] |
270 assert orig[index[i]]['y']==y | 270 assert (orig[index[i]]['y']==y).all() |
271 assert (orig[index[i]]['z']==array[index[i]][0:3:2]).all() | 271 assert (orig[index[i]]['z']==array[index[i]][0:3:2]).all() |
272 assert (orig[index[i]]['z']==z).all() | 272 assert (orig[index[i]]['z']==z).all() |
273 i+=1 | 273 i+=1 |
274 del i | 274 del i |
275 ds[0] | 275 ds[0] |
287 assert isinstance(ds2,LookupList) | 287 assert isinstance(ds2,LookupList) |
288 test_ds(ds,ds2,index=[0,1,2]) | 288 test_ds(ds,ds2,index=[0,1,2]) |
289 del ds2 | 289 del ds2 |
290 | 290 |
291 #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. | 291 #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. |
292 ds2=ds[1:7:2] | 292 ds2=ds.subset[1:7:2] |
293 assert isinstance(ds2,LookupList) | 293 assert isinstance(ds2,DataSet) |
294 test_ds(ds,ds2,[1,3,5]) | 294 test_ds(ds,ds2,[1,3,5]) |
295 del ds2 | 295 del ds2 |
296 | 296 |
297 #ds[i] | 297 #ds[i] |
298 ds2=ds[5] | 298 ds2=ds[5] |
300 assert have_raised("var['ds']["+str(len(ds))+"]",ds=ds) # index not defined | 300 assert have_raised("var['ds']["+str(len(ds))+"]",ds=ds) # index not defined |
301 assert not have_raised("var['ds']["+str(len(ds)-1)+"]",ds=ds) | 301 assert not have_raised("var['ds']["+str(len(ds)-1)+"]",ds=ds) |
302 del ds2 | 302 del ds2 |
303 | 303 |
304 #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. | 304 #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. |
305 ds2=ds[[4,7,2,8]] | 305 ds2=ds.subset[[4,7,2,8]] |
306 assert isinstance(ds2,DataSet) | 306 assert isinstance(ds2,DataSet) |
307 test_ds(ds,ds2,[4,7,2,8]) | 307 test_ds(ds,ds2,[4,7,2,8]) |
308 del ds2 | 308 del ds2 |
309 | 309 |
310 #ds.<property># returns the value of a property associated with | 310 #ds.<property># returns the value of a property associated with |