changeset 728:71a052a92b05

Made test_speed faster when run by nosetests
author Olivier Delalleau <delallea@iro>
date Wed, 27 May 2009 12:08:18 -0400
parents d57df00f12b0
children d4e703a617ba
files pylearn/sandbox/test_speed.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sandbox/test_speed.py	Wed May 27 11:48:05 2009 -0400
+++ b/pylearn/sandbox/test_speed.py	Wed May 27 12:08:18 2009 -0400
@@ -63,10 +63,16 @@
     f_ds_mb1(ds,1000)
     f_ds_mb1(ds,10000)
 
-def test_speed():
+# Subset of tests when run by nosetests.
+def run_test():
     a2 = numpy.random.rand(100000,400)
     ds1 = ArrayDataSet(a2,{'all':slice(0,a2.shape[1],1)})
-    run(a2,ds1)
+    run(a2, ds1)
+    return a2, ds1
+
+# Full set of tests when run from command line.
+def run_full():
+    a2, ds1 = run_test()
     a1 = numpy.random.rand(100000,40)
     ds4 = ArrayDataSet(a1,LookupList(["f"+str(x)for x in range(a1.shape[1])],
                                      range(a1.shape[1])))
@@ -79,4 +85,5 @@
     del a2,ds1,ds3
 
 if __name__=='__main__':
-    test_speed()
+    run_full()
+