Changeset 82923a6 in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Apr 18, 2016 8:31:11 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3a45c2c, f36c1b7
Parents:
7835d462
Message:

allow tests against inf and nan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    re78edc4 r82923a6  
    207207                    self.assertTrue(np.isfinite(actual_yi), 
    208208                                    'invalid f(%s): %s' % (xi, actual_yi)) 
     209                elif np.isnan(yi): 
     210                    self.assertTrue(np.isnan(actual_yi), 
     211                                    'f(%s): expected:%s; actual:%s' 
     212                                    % (xi, yi, actual_yi)) 
    209213                else: 
    210                     self.assertTrue(is_near(yi, actual_yi, 5), 
     214                    # is_near does not work for infinite values, so also test 
     215                    # for exact values.  Note that this will not 
     216                    self.assertTrue(yi==actual_yi or is_near(yi, actual_yi, 5), 
    211217                                    'f(%s); expected:%s; actual:%s' 
    212218                                    % (xi, yi, actual_yi)) 
Note: See TracChangeset for help on using the changeset viewer.