changeset 294:f7924e13e426

Automated merge with ssh://projects@lgcm.iro.umontreal.ca/hg/pylearn
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Fri, 06 Jun 2008 16:15:47 -0400
parents 4bfdda107a17 (current diff) 3af204aa71e5 (diff)
children 7380376816e5 f5d33f9c0b9c
files _test_dataset.py
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/_test_dataset.py	Fri Jun 06 16:13:17 2008 -0400
+++ b/_test_dataset.py	Fri Jun 06 16:15:47 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):
@@ -430,7 +430,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):
@@ -442,5 +448,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"