Changeset 594 for branches


Ignore:
Timestamp:
11/20/12 10:08:47 (3 years ago)
Author:
mmckerns
Message:

fix: correct more typos in test_wrapper

Location:
branches/decorate
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/decorate/test_wrapper.py

    r593 r594  
    101101def test_bounded(): 
    102102 
    103   @bounded(min=1,max=10-1e-8) 
     103  @bounded(min=1,max=9.9999) 
    104104  def squared(x): 
    105105    return x**2 
     
    112112  x = array(x) 
    113113  y = squared(x) 
    114   assert y == [i**2 if i in range(1,10) else inf for i in x] 
     114  assert y == inf #XXX: better, [i**2 if i in range(1,10) else inf for i in x] ? 
    115115 
    116116 
     
    135135 
    136136  assert discrete_squared(5.6) == 5.5**2 
    137   assert discrete_squared([1, 3]) == asarray([1.0, 3.5])**2 
     137  assert all(discrete_squared([1, 3]) == asarray([1.0, 3.5])**2) 
    138138  discrete_squared.samples([1.0, 7.0]) 
    139139  assert discrete_squared(5.6) == 7.0**2 
  • branches/decorate/wrapper.py

    r591 r594  
    8484            def func(x, *args, **kwds): 
    8585                if any((x<min)|(x>max)): #if violate bounds, evaluate as inf 
    86                     return inf 
     86                    return inf #XXX: better, return x with xi=inf where violate? 
    8787                return f(x, *args, **kwds) 
    8888        else: 
Note: See TracChangeset for help on using the changeset viewer.