# HG changeset patch # User Frederic Bastien # Date 1210705884 14400 # Node ID 0040ba0f06666a45f67ff13e6fb47ff3c920a120 # Parent b60cd6745dc210301c8999942d9829f809c43dcc small refactoring diff -r b60cd6745dc2 -r 0040ba0f0666 test_dataset.py --- a/test_dataset.py Tue May 13 15:04:51 2008 -0400 +++ b/test_dataset.py Tue May 13 15:11:24 2008 -0400 @@ -394,6 +394,13 @@ assert len(ds('y').fields()) == 1 del field +def test_all(array,ds): + assert len(ds)==10 + + test_iterate_over_examples(array, ds) + test_getitem(array, ds) + test_ds_iterator(array,ds('x','y'),ds('y','z'),ds('x','y','z')) + test_fields_fct(ds) def test_ArrayDataSet(): #don't test stream @@ -406,13 +413,9 @@ a2 = numpy.random.rand(10,4) ds = ArrayDataSet(a2,{'x':slice(3),'y':3,'z':[0,2]})###???tuple not tested ds = ArrayDataSet(a2,LookupList(['x','y','z'],[slice(3),3,[0,2]]))###???tuple not tested - assert len(ds)==10 #assert ds==a? should this work? - test_iterate_over_examples(a2, ds) - test_getitem(a2, ds) - test_ds_iterator(a2,ds('x','y'),ds('y','z'),ds('x','y','z')) - test_fields_fct(ds) + test_all(a2,ds) del a2, ds @@ -442,18 +445,9 @@ ds1 = ArrayDataSet(a,LookupList(['x','y','z'],[slice(3),3,[0,2]]))###???tuple not tested ds2 = CachedDataSet(ds1) ds3 = CachedDataSet(ds1,cache_all_upon_construction=True) - assert len(ds2)==10 - assert len(ds3)==10 - test_iterate_over_examples(a, ds2) - test_getitem(a, ds2) - test_ds_iterator(a,ds2('x','y'),ds2('y','z'),ds2('x','y','z')) - test_fields_fct(ds2) - - test_iterate_over_examples(a, ds3) - test_getitem(a, ds3) - test_ds_iterator(a,ds3('x','y'),ds3('y','z'),ds3('x','y','z')) - test_fields_fct(ds3) + test_all(a2,ds2) + test_all(a2,ds3) del a,ds1,ds2,ds3