Mercurial > pylearn
diff test_dataset.py @ 194:0040ba0f0666
small refactoring
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 13 May 2008 15:11:24 -0400 |
parents | 1255cd86df36 |
children | 363752267470 |
line wrap: on
line diff
--- 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