# HG changeset patch # User Frederic Bastien # Date 1212783343 14400 # Node ID 3af204aa71e58d3714290d9f5d93a20217ca5af9 # Parent 2d08f46d17d8b2661615e26ae5a838ac2d70edb2 implemented test for FieldsSubsetDataSet. if executed, can take a --debug option to be used in a debugger diff -r 2d08f46d17d8 -r 3af204aa71e5 _test_dataset.py --- a/_test_dataset.py Fri Jun 06 14:08:28 2008 -0400 +++ b/_test_dataset.py Fri Jun 06 16:15:43 2008 -0400 @@ -1,7 +1,7 @@ #!/bin/env python from dataset import * from math import * -import numpy,unittest +import numpy, unittest, sys from misc import * def have_raised(to_eval, **var): @@ -426,7 +426,13 @@ del a,ds1,ds2,ds3 def test_FieldsSubsetDataSet(self): - raise NotImplementedError() + a = numpy.random.rand(10,4) + ds = ArrayDataSet(a,LookupList(['x','y','z','w'],[slice(3),3,[0,2],0])) + ds = FieldsSubsetDataSet(ds,['x','y','z']) + + test_all(a,ds) + + del a, ds def test_MinibatchDataSet(self): raise NotImplementedError() def test_HStackedDataSet(self): @@ -438,5 +444,14 @@ if __name__=='__main__': - unittest.main() + if len(sys.argv)==2: + if sys.argv[1]=="--debug": + module = __import__("_test_dataset") + tests = unittest.TestLoader().loadTestsFromModule(module) + tests.debug() + print "bad argument: only --debug is accepted" + elif len(sys.argv)==1: + unittest.main() + else: + print "bad argument: only --debug is accepted"