Mercurial > pylearn
comparison _test_dataset.py @ 311:0690de82c338
a lot of tests are broken because of the new behaviour of __getitem__ that always returns a LookupList, working on that...
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Wed, 11 Jun 2008 12:45:24 -0400 |
parents | eded3cb54930 |
children | 96cca78de3ed |
comparison
equal
deleted
inserted
replaced
310:ebccfd05ccd5 | 311:0690de82c338 |
---|---|
256 assert y==array[i][3] | 256 assert y==array[i][3] |
257 assert (z==array[i][0:3:2]).all() | 257 assert (z==array[i][0:3:2]).all() |
258 assert (numpy.append(x,y)==array[i]).all() | 258 assert (numpy.append(x,y)==array[i]).all() |
259 i+=1 | 259 i+=1 |
260 assert i==l | 260 assert i==l |
261 | 261 |
262 def test_getitem(array,ds): | 262 def test_getitem(array,ds): |
263 def test_ds(orig,ds,index): | 263 def test_ds(orig,ds,index): |
264 i=0 | 264 i=0 |
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'): |
282 for x in ds: | 282 for x in ds: |
283 pass | 283 pass |
284 | 284 |
285 #ds[:n] returns a dataset with the n first examples. | 285 #ds[:n] returns a dataset with the n first examples. |
286 ds2=ds[:3] | 286 ds2=ds[:3] |
287 assert isinstance(ds2,DataSet) | 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[1:7:2] |
293 assert isinstance(ds2,DataSet) | 293 assert isinstance(ds2,LookupList) |
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] |