# HG changeset patch # User Frederic Bastien # Date 1209737664 14400 # Node ID 14589f02a3725cd52c6d6e2d467ba3693b0c41d0 # Parent 23bf2c9eb7b3b186625c0de487d466ba986c58db more test diff -r 23bf2c9eb7b3 -r 14589f02a372 test_dataset.py --- a/test_dataset.py Fri May 02 10:14:01 2008 -0400 +++ b/test_dataset.py Fri May 02 10:14:24 2008 -0400 @@ -66,11 +66,11 @@ # print "take a slice and look at field y",ds[1:6:2]["y"] have_thrown = False try: - ds['h'] + ds['h'] # h is not defined... except : have_thrown = True assert have_thrown == True - assert ds == ds.fields().examples() + assert len(ds.fields())==3 for field in ds.fields(): for field_value in field: # iterate over the values associated to that field for all the ds examples pass @@ -81,5 +81,33 @@ for field_examples in ds.fields(): for example_value in field_examples: pass + + assert ds == ds.fields().examples() + + + #test missing value + + assert len(ds[:3])==3 + for x,z in ds[:3]('x','z'): + assert ds[i]['z'].all()==a[i][0:3:2].all() + + #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s. + + #ds[i]# returns an Example. + + #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in. + + #ds[fieldname]# an iterable over the values of the field fieldname across + #the ds (the iterable is obtained by default by calling valuesVStack + #over the values for individual examples). + + #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]) + #* ds1 & ds2 & ds3 == ds.vstack([ds1,ds2,ds3]) + + test_ArrayDataSet()