Mercurial > pylearn
changeset 176:6ee54861134e
Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Tue, 13 May 2008 15:11:39 -0400 |
parents | b60cd6745dc2 (diff) e9a95e19e6f8 (current diff) |
children | 9911d2cc3c01 |
files | |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/test_dataset.py Tue May 13 15:11:24 2008 -0400 +++ b/test_dataset.py Tue May 13 15:11:39 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]