changeset 173:1255cd86df36

more test
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 13 May 2008 15:03:16 -0400
parents 895b4b60f5e8
children b60cd6745dc2
files test_dataset.py
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test_dataset.py	Tue May 13 13:23:05 2008 -0400
+++ b/test_dataset.py	Tue May 13 15:03:16 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]