comparison test_dataset.py @ 276:271a16d42072

removed test_lookuplist from test_dataset
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 05 Jun 2008 14:16:46 -0400
parents fdce496c3b56
children 6255359318bf 9b533cc7874a
comparison
equal deleted inserted replaced
275:323909110d1c 276:271a16d42072
424 424
425 test_all(a2,ds) 425 test_all(a2,ds)
426 426
427 del a2, ds 427 del a2, ds
428 428
429 def test_LookupList():
430 #test only the example in the doc???
431 print "test_LookupList"
432 example = LookupList(['x','y','z'],[1,2,3])
433 example['x'] = [1, 2, 3] # set or change a field
434 x, y, z = example
435 x = example[0]
436 x = example["x"]
437 assert example.keys()==['x','y','z']
438 assert example.values()==[[1,2,3],2,3]
439 assert example.items()==[('x',[1,2,3]),('y',2),('z',3)]
440 example.append_keyval('u',0) # adds item with name 'u' and value 0
441 assert len(example)==4 # number of items = 4 here
442 example2 = LookupList(['v','w'], ['a','b'])
443 example3 = LookupList(['x','y','z','u','v','w'], [[1, 2, 3],2,3,0,'a','b'])
444 assert example+example2==example3
445 assert have_raised("var['x']+var['x']",x=example)
446
447 del example, example2, example3, x, y ,z
448
449 def test_CachedDataSet(): 429 def test_CachedDataSet():
450 print "test_CacheDataSet" 430 print "test_CacheDataSet"
451 a = numpy.random.rand(10,4) 431 a = numpy.random.rand(10,4)
452 ds1 = ArrayDataSet(a,LookupList(['x','y','z'],[slice(3),3,[0,2]]))###???tuple not tested 432 ds1 = ArrayDataSet(a,LookupList(['x','y','z'],[slice(3),3,[0,2]]))###???tuple not tested
453 ds2 = CachedDataSet(ds1) 433 ds2 = CachedDataSet(ds1)
559 f_ds_mb2(ds,10000) 539 f_ds_mb2(ds,10000)
560 540
561 541
562 if __name__=='__main__': 542 if __name__=='__main__':
563 test1() 543 test1()
564 test_LookupList()
565 test_ArrayDataSet() 544 test_ArrayDataSet()
566 test_CachedDataSet() 545 test_CachedDataSet()
567 test_ApplyFunctionDataSet() 546 test_ApplyFunctionDataSet()
568 #test_speed() 547 #test_speed()
569 #test pmat.py 548 #test pmat.py