# HG changeset patch # User Frederic Bastien # Date 1213733399 14400 # Node ID 2174fe5cc7d0b936a3cc9afaa01c8b51e472cf6c # Parent 952129cd55cb7b44eceab685bcd8a562949d8e3f added test for ds.subset() diff -r 952129cd55cb -r 2174fe5cc7d0 _test_dataset.py --- a/_test_dataset.py Tue Jun 17 14:59:10 2008 -0400 +++ b/_test_dataset.py Tue Jun 17 16:09:59 2008 -0400 @@ -371,11 +371,11 @@ #ds[:n] returns a dataset with the n first examples. ds2=ds.subset[:3] test_ds(ds,ds2,index=[0,1,2]) -# del ds2 +# del ds2 -# #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. -# ds2=ds.subset[1:7:2] -# test_ds(ds,ds2,[1,3,5]) +#ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. + ds2=ds.subset[1:7:2] + test_ds(ds,ds2,[1,3,5]) # del ds2 # #ds[i] @@ -385,29 +385,29 @@ # assert not have_raised("var['ds']["+str(len(ds)-1)+"]",ds=ds) # del ds2 -# #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. -# ds2=ds.subset[[4,7,2,8]] -# test_ds(ds,ds2,[4,7,2,8]) +#ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. + ds2=ds.subset[[4,7,2,8]] + test_ds(ds,ds2,[4,7,2,8]) # del ds2 -# #ds.# returns the value of a property associated with -# #the name . The following properties should be supported: -# # - 'description': a textual description or name for the ds -# # - 'fieldtypes': a list of types (one per field) +#ds.# returns the value of a property associated with + #the name . The following properties should be supported: + # - 'description': a textual description or name for the ds + # - 'fieldtypes': a list of types (one per field) -# #* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])#???? -# #assert hstack([ds('x','y'),ds('z')])==ds -# #hstack([ds('z','y'),ds('x')])==ds -# assert have_raised2(hstack,[ds('x'),ds('x')]) -# assert have_raised2(hstack,[ds('y','x'),ds('x')]) -# assert not have_raised2(hstack,[ds('x'),ds('y')]) +#* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])#???? + #assert hstack([ds('x','y'),ds('z')])==ds + #hstack([ds('z','y'),ds('x')])==ds + assert have_raised2(hstack,[ds('x'),ds('x')]) + assert have_raised2(hstack,[ds('y','x'),ds('x')]) + assert not have_raised2(hstack,[ds('x'),ds('y')]) -# # i=0 -# # for example in hstack([ds('x'),ds('y'),ds('z')]): -# # example==ds[i] -# # i+=1 -# # del i,example -# #* ds1 & ds2 & ds3 == ds.vstack([ds1,ds2,ds3])#???? +# i=0 +# for example in hstack([ds('x'),ds('y'),ds('z')]): +# example==ds[i] +# i+=1 +# del i,example +#* ds1 & ds2 & ds3 == ds.vstack([ds1,ds2,ds3])#???? def test_fields_fct(ds): #@todo, fill correctly