Mercurial > pylearn
diff test_dataset.py @ 174:b60cd6745dc2
Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 13 May 2008 15:04:51 -0400 |
parents | 1255cd86df36 |
children | 0040ba0f0666 |
line wrap: on
line diff
--- a/test_dataset.py Tue May 13 14:28:47 2008 -0400 +++ b/test_dataset.py Tue May 13 15:04:51 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]