diff test_dataset.py @ 179:9911d2cc3c01

merged
author James Bergstra <bergstrj@iro.umontreal.ca>
date Tue, 13 May 2008 15:14:04 -0400
parents 1255cd86df36
children 0040ba0f0666
line wrap: on
line diff
--- a/test_dataset.py	Tue May 13 15:12:20 2008 -0400
+++ b/test_dataset.py	Tue May 13 15:14:04 2008 -0400
@@ -4,7 +4,6 @@
 import numpy
 
 def have_raised(to_eval, **var):
-    
     have_thrown = False
     try:
         eval(to_eval)
@@ -12,6 +11,14 @@
         have_thrown = True
     return have_thrown
 
+def have_raised2(f, *args, **kwargs):
+    have_thrown = False
+    try:
+        f(*args, **kwargs)
+    except :
+        have_thrown = True
+    return have_thrown
+
 def test1():
     print "test1"
     global a,ds
@@ -325,12 +332,12 @@
   #    - 'fieldtypes': a list of types (one per field)
 
 #* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])#????
-    #hstack([ds('x','y'),ds('z')]
-    #hstack([ds('z','y'),ds('x')]
-    #assert have_thrown("hstack([ds('x'),ds('x')]")
-    #assert not have_thrown("hstack([ds('x'),ds('x')]")
-    #accept_nonunique_names
-    #assert have_thrown("hstack([ds('y','x'),ds('x')]")
+    #assert hstack([ds('x','y'),ds('z')])==ds
+    #hstack([ds('z','y'),ds('x')])==ds
+    assert have_raised2(hstack,[ds('x'),ds('x')])
+    assert have_raised2(hstack,[ds('y','x'),ds('x')])
+    assert not have_raised2(hstack,[ds('x'),ds('y')])
+    
 #        i=0
 #        for example in hstack([ds('x'),ds('y'),ds('z')]):
 #            example==ds[i]