comparison 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
comparison
equal deleted inserted replaced
172:fb4837eed1a6 174:b60cd6745dc2
2 from dataset import * 2 from dataset import *
3 from math import * 3 from math import *
4 import numpy 4 import numpy
5 5
6 def have_raised(to_eval, **var): 6 def have_raised(to_eval, **var):
7
8 have_thrown = False 7 have_thrown = False
9 try: 8 try:
10 eval(to_eval) 9 eval(to_eval)
10 except :
11 have_thrown = True
12 return have_thrown
13
14 def have_raised2(f, *args, **kwargs):
15 have_thrown = False
16 try:
17 f(*args, **kwargs)
11 except : 18 except :
12 have_thrown = True 19 have_thrown = True
13 return have_thrown 20 return have_thrown
14 21
15 def test1(): 22 def test1():
323 #the name <property>. The following properties should be supported: 330 #the name <property>. The following properties should be supported:
324 # - 'description': a textual description or name for the ds 331 # - 'description': a textual description or name for the ds
325 # - 'fieldtypes': a list of types (one per field) 332 # - 'fieldtypes': a list of types (one per field)
326 333
327 #* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])#???? 334 #* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])#????
328 #hstack([ds('x','y'),ds('z')] 335 #assert hstack([ds('x','y'),ds('z')])==ds
329 #hstack([ds('z','y'),ds('x')] 336 #hstack([ds('z','y'),ds('x')])==ds
330 #assert have_thrown("hstack([ds('x'),ds('x')]") 337 assert have_raised2(hstack,[ds('x'),ds('x')])
331 #assert not have_thrown("hstack([ds('x'),ds('x')]") 338 assert have_raised2(hstack,[ds('y','x'),ds('x')])
332 #accept_nonunique_names 339 assert not have_raised2(hstack,[ds('x'),ds('y')])
333 #assert have_thrown("hstack([ds('y','x'),ds('x')]") 340
334 # i=0 341 # i=0
335 # for example in hstack([ds('x'),ds('y'),ds('z')]): 342 # for example in hstack([ds('x'),ds('y'),ds('z')]):
336 # example==ds[i] 343 # example==ds[i]
337 # i+=1 344 # i+=1
338 # del i,example 345 # del i,example