comparison test_dataset.py @ 87:3fd6879e0f76

removed print
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 05 May 2008 14:39:04 -0400
parents fdf72ea4f2bc
children 05dc4804357b
comparison
equal deleted inserted replaced
86:fdf72ea4f2bc 87:3fd6879e0f76
89 89
90 def test_ds(orig,ds,index): 90 def test_ds(orig,ds,index):
91 i=0 91 i=0
92 assert len(ds)==len(index) 92 assert len(ds)==len(index)
93 for x,z,y in ds('x','z','y'): 93 for x,z,y in ds('x','z','y'):
94 print x,y,z
95 assert orig[index[i]]['x'].all()==a[index[i]][:3].all() 94 assert orig[index[i]]['x'].all()==a[index[i]][:3].all()
96 assert orig[index[i]]['x'].all()==x.all() 95 assert orig[index[i]]['x'].all()==x.all()
97 assert orig[index[i]]['y']==a[index[i]][3] 96 assert orig[index[i]]['y']==a[index[i]][3]
98 assert orig[index[i]]['y']==y 97 assert orig[index[i]]['y']==y
99 assert orig[index[i]]['z'].all()==a[index[i]][0:3:2].all() 98 assert orig[index[i]]['z'].all()==a[index[i]][0:3:2].all()
108 #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. 107 #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s.
109 ds2=ds[1:7:2] 108 ds2=ds[1:7:2]
110 ds2[1] 109 ds2[1]
111 test_ds(ds,ds2,[1,3,5]) 110 test_ds(ds,ds2,[1,3,5])
112 #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. 111 #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in.
113 # ds2=ds[[4,7,2,8]]# fail 112 # ds2=ds[[4,7,2,8]]# fail???
114 # assert len(ds2)==4 113 # assert len(ds2)==4
115 # i=0 114 # i=0
116 # index=[4,7,2,8] 115 # index=[4,7,2,8]
117 # for x in ds2: 116 # for x in ds2:
118 # assert ds[index[i]]['x'].all()==a[index[i]][:3].all() 117 # assert ds[index[i]]['x'].all()==a[index[i]][:3].all()