# HG changeset patch # User Frederic Bastien # Date 1210705396 14400 # Node ID 1255cd86df3611082fed7d81ea482e39b72d1baf # Parent 895b4b60f5e8bbb7b68a67fa3248e367b55b15b7 more test diff -r 895b4b60f5e8 -r 1255cd86df36 test_dataset.py --- 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]